Forum Moderators: open

Message Too Old, No Replies

Force a refresh of page

when closing popup

         

aspdaddy

12:18 pm on Sep 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a popup page where users request a feature, it works from javaScript on the main page:

window.open (sURL & "?p=" & document.frmProfile.sPage.value)

After the request, the popup submits to itself and says "OK",and the user closes the popup.

Is they some way to force the main page to refresh/f5 when this happens.

rocknbil

8:23 pm on Sep 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Write something in the original pop-up code that passes the current URL to the pop-up window.

onClick="return myPopupRoutine('example.html','thispage.html');

where myPopupRoutine contains the window.open commands, etc.

Then you do something this in the pop-up window:

window.opener.location=url;
window.close();
... where url is the original url from the window.opener. You can also use reload() but if the original window is results from a submitted form you will get that re-submit message from the browser which is kinda messy.

If you can't gather it from this idea I have some code here I can drop in, but have to hunt it down. :-)

Trace

7:45 pm on Sep 10, 2007 (gmt 0)

10+ Year Member



Hey rocknbil,
what's the advantage of using;

window.opener.location=url;
window.close();

instead of something like;

opener.document.location.reload();
window.close();

rocknbil

8:14 pm on Sep 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would think only this:

You can also use reload() but if the original window is results from a submitted form you will get that re-submit message from the browser which is kinda messy.

Trace

12:53 pm on Sep 11, 2007 (gmt 0)

10+ Year Member



Oh, ha! I'm sorry, I completely missed that.

aspdaddy

9:54 am on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks guys. Got it working ok with:


<SCRIPT LANGUAGE="JavaScript">
<!--
if (window.opener) {
//window.opener.location.href = "mypage.asp" -- this line not required
window.opener.location.reload(true);
}
-->
</script>