Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Close Pop-up window and refresh parent page in IE

8:21 am on Nov 18, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:June 16, 2011
posts: 79
votes: 0

Hello Everyone,

I've got some JavaScript that works well in Firefox to pop up a window... then when a link is clicked inside of the window, the pop-up is closed, the parent page is re-freshed and the offset/scrollbar of the parent page stays the same after re-freshing.

In IE, however, the pop-up does not close but the parent page re-freshes (but does not hold the same page position). Wondering if there is something I could add to make the pop-up window close in IE as well to make the script more browser compatible.

Current Code:

function close_this_window(){
//sets $pageoffset which makes parent page re-load
//and have the scrollbar rest in same position rather
//than starting back up at top of the page
$pageoffset = window.opener.document.body.scrollTop;
window.opener.document.body.scrollTop = $pageoffset;
return false;

//AJAX stuff etc etc then the following:

$.post('process.php', $("#myform").serialize(), function(data) {
if (data == "success") {


trying to end the Ajax request with the close_this_window() function but not getting IE to be able to close pop up window.

Anyone know what could be preventing it from closing in IE?
12:26 pm on Nov 22, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 30, 2007
votes: 0

Where is the code that opens the popup window? I tried the popup code here I don't see a problem on IE, what I did I created a popup window and then used the close_this_window() function. Other than declaring the $pageoffset var before using it, I could not see a problem. The popup was closed as expected.

Any js errors that show up when you run it on IE?