You need to sign in to do that
Don't have an account?
Sheffy
Close The PopUp(Child Window) and refresh Parent Window ?
HI,
I want to know that how would i refresh Parent Window on Clicking of Save/Submit button on PopUp window or we can say Child window.
For this I used JavaScript ;
<script language="JavaScript" type="text/javascript">
function CloseAndRefresh(){
opener.location.reload(true);
self.close();
}
</script>
On Submit :
<apex:commandButton action="{!save}" onclick="CloseAndRefresh()" value="Save"/>
But It doesn't Work .
Please Help ..
Hey Sheffy,
It depends, if the parent window is a Vf page and your child window is also a VF page, than you can refresh the parent window because your both the pages are on same domain.
In case you want to refresh the standard salesforce page (parent page) from a custom VF page (child page), this wont happen as salesforce saves it standard application pages on a different domain than Vf pages.
Try this:
This is not working... :(
Are you getting any error?
Can you confirm if the parent window is a VF page and what is the URL of your parent window and child window?
not an error,
but crome going to stop work i.e. I'm not able to click anywhere in different tab.
url is same ...
When you open the child window, you can assign it to a variable like
var childWin;//declare global
var intervalId;// declare global
//Code to invoke the popup
childWin = window.open(URL);
intervalId = window.setInterval('checkIfChildWindowIsClosed()', 5*1000);
//add thios function
function checkIfChildWindowIsClosed()
{
if(childWin.close())
{
window.clearInterval(intervalId);
window.parent.location.href = window.parent.location.href;
}
}
Let me know if you have any questions
To remind, add the code i posted into the javascript code of your parent and not the child.
From Childs code remove opener.location.reload(true);
Even though standard pages are hosted on different domains, they can still be refreshed from VF page.
Imran,
Can you please tell me how can I refresh standard page layout from VFP. I am involving VFP by onclick Javascript function and calling my page by showmodaldialog.
Please let me know how can I refresh standard page layout from this pop up when I save a record.
Thank you!
Regards,
Lakshman
Any luck? I'm having the same problem. It doesn't seem like there's any way to do this since it's cross domain - unless Salesforce opened up some sort of cross domain way to tell the parent to refresh.
Am I missing something?
I worked with Imran Mohammed's solution until I found something that might work for me, so I thought I'd share.
The problems with Imram's solution are:
- JavaScript on Standard Layouts is run in an anonymous function, not in global scope
- It is calling "childWin.close()" which closes the window -- it should be "if (childWin.closed)" (a property)
Here's what I did:
I created a Custom Button with "Display Type" = "Detail Page Button" (or link). Behavior = "Execute JavaScript".
It opens a VisualForce page and then waits for it to close, then refreshes when done. I did make this button only show in VIEW mode, as with Edit mode you'd have to take precautions to make sure you don't refresh a page where edits have already taken place.
Here's the JavaScript:
This works pretty well for me. Though, sometimes the 5-second interval seems too long... i might shorten it up a bit to make it flow better.
Here is the solution to your problem and also it considers cross domain issues.
http://techstuffdiary.blogspot.in/2013/10/reloading-parent-window-on-close-of.html
Thanks!!!!
but using above method..(Croos domain)
I am getting error like object doesn't support this property or method in IE