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
DipikaDipika 

refresh parent window from child window in internet explorer

hi,

        I want to close the child window with refreshing parent window. I have used the code.

 

function closePage(){

window.opener.parent.location.replace('/{$CurrentPage.parameters.id}');

window.close();

}

 

it is working in firfox,chrome but not working in internet explorer.

 

can someone suggest for internet explorer what should be the code?

bob_buzzardbob_buzzard

Some browsers only allow the child window to be closed from the parent window that opened up.  That being the case, you'd need to put your javascript into the parent window to close the child and then refresh itself.

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code in JavaScript of your child window page

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

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

DipikaDipika

hi, 

    I am opening the child window by custom button from detail page of standard object.

   So i cant write code to refresh the parent page,

 

Is there any other solution?

DipikaDipika

hi,

     Its also not working.

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

 

Thanks

Damien_Damien_

I have used

 

window.opener.location.reload();

 

and it worked from a child window.  This only works on every major browser, that used javascript to open the child window.

vikramkkvikramkk

It may refresh parent window. But does it closes the child window?

vikramkkvikramkk

Hi

 

I am facing the exact issue. Did you get any solution? If so  please post here.

 

Thanks

 

 

Damien_Damien_

If you need to additionally close the child window, you just need to add 1 more line after:

 

window.opener.location.reload();

window.close();//This only works if the child window was created from javascript

vanessenvanessen
I confirm that :
window.opener.location.reload();
do not work even if i'm opening my child window from javascript
bhanushree hassanbhanushree hassan
Even I am facing the same issue.. It is working in fine in chrome but not in IE.
Is anybody having any solution for this
souvik chakrabortysouvik chakraborty
window.opener.location.reload() will not work in all browsers.
Try the below mentioned code, it works in IE, Chrome etc. all browsers
window.top.opener.location.href="/{!$CurrentPage.parameters.id}"; // Give here your parent page url
window.top.close();

If this solution helps you to solve your problem, please mark this question as solved.
r@hulr@hul

Hi Souvik,

The above solution is the same which I have used when opening a vf from custom list button , but that opens a new tab in IE instead of refreshing parent.

Thanks

Rahul

vanessenvanessen
For my case, I don't use the window.opener now, but instead im using the postmessage functionality. This allow cross-domain communication and it allows communication between the children and parent and parent to children. It works for iframe communications. Maybe this can help.
http://javascript.info/tutorial/cross-window-messaging-with-postmessage
https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage