function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aamDevaamDev 

Refresh Parent Window from Popup

I created a list button that opens a popup VF page which contains a form. After the form is saved, I want the popup to close and for the parent window to be refreshed. The refresh works great on FireFox and Chrome, but IE8 is somehow opening the parent window in a new window, instead of just refreshing the existing window. I've gone through various methods of opening a new window (window.showModalDialog, window.open, etc) and have settled on window.open() in my list button. I also found a great piece of code on the forum that returns values from my controller, closes my pop up and refreshes the parent window. 

 

Why is IE8 opening a new window instead of just refreshing the existing one?

 

List button javascript:

 

window.open('/apex/quickCreateProduction?id={!Contact.Id}',"window","width=460, height=375");

 Javascript in VF page (popup):

 

<script language="javascript" type="text/javascript">
if("{!$Request.success}" == "true") {
	parent.window.close();
	parent.window.opener.location.href = "/{!$Request.id}";          
}
</script>

 

Save in custom controller (after success):

 

		PageReference curPage = ApexPages.currentPage();
		curPage.getParameters().put('success','true');
		curPage.getParameters().put('id',Apexpages.currentPage().getParameters().get('id'));
		curPage.setRedirect(true);
		return curPage;

 

I could definitely use some help. Thanks in advance.

 

Adriel

Best Answer chosen by Admin (Salesforce Developers) 
aamDevaamDev

Thank you everyone for your help. I got tired with the issues in IE8 and after speaking with my BA we settled for a manual refresh on the parent:

 

<script language="javascript" type="text/javascript">
if("{!$Request.success}" == "true") {
	parent.window.close();
	alert('Please refresh the Contact page to view your changes.');
	window.close();
}
</script>

 

Thanks again.

All Answers

ladocelotladocelot

Hi, i have the same problem with IE8.

 

Any solution??

 

thanks

 

greetings

 

 

aamDevaamDev

Nothing yet, but I'll post it when I do.

 

Adriel

yogoyogo

Hi,

 

If you want to reload the same page  try this code : 

 

 

parent.window.opener.location.reload();

 

 

Pradeep_NavatarPradeep_Navatar

You can use :

 

window.parent.parent.window.opener.location.href = "/{!$Request.id}";

 

or               

 

Parent Page: <input onclick="ppppp();" />

           <script>

                  function ppppp()

                  {

                     var acid = document.getElementById('xyz').value;

                     fetchdata1(acid);

                  }

            </script>

 

             Note : fetchdata1 is an actionfunction.      

 

             In popup page :

                                                window.parent.parent.opener.document.getElementById('xyz').onclick();     

 

Hope this helps.                                  

ladocelotladocelot

I try with:

window.parent.parent.window.opener.location.href = "/{!$Request.id}";

 

with IE8 open a new windows :smileysad:

aamDevaamDev

Thank you everyone for your help. I got tired with the issues in IE8 and after speaking with my BA we settled for a manual refresh on the parent:

 

<script language="javascript" type="text/javascript">
if("{!$Request.success}" == "true") {
	parent.window.close();
	alert('Please refresh the Contact page to view your changes.');
	window.close();
}
</script>

 

Thanks again.

This was selected as the best answer
wbrproductionswbrproductions

Thanks, this worked perfectly!