Welcome to WebmasterWorld Guest from 54.227.5.198

Forum Moderators: open

Message Too Old, No Replies

Close Pop-up window and refresh parent page in IE

     

tec4

8:21 am on Nov 18, 2011 (gmt 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.location.reload();
window.opener.document.body.scrollTop = $pageoffset;
window.close();
return false;
}


//AJAX stuff etc etc then the following:

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

close_this_window();
}
});


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?

enigma1

12:26 pm on Nov 22, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



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?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month