Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.
25% off Hosting at HostGator.com:
Use Code techbits25



How to refresh the parent window from a pop up window.

Last updated: 06/26/2009

Sometimes you want to refresh the parent / main window from a popup window.  For instance, if the popup window causes some data to change, which affects the information on the parent page. 

Within the popup, after making the change, you can embed the following javascript:

<script type="text/javascript">
var URL = unescape(window.opener.location.pathname); window.opener.location.href = URL;
</script>

This causes the parent window to reload - it won't maintain page position, but will get the job done otherwise.  You could append the page anchor to the above code, if you know it precisely.

If you want to do this when closing the window, just add it to the code for the "onClick" of the button. 

blog comments powered by Disqus
Have your own Tech-bit to contribute? Submit it here

Other questions in this category:
How can I open a new window using Javascript?
How can I add a quick javascript error page to my cgi / php scripts
How can I validate a form that has brackets in the variable names?
Why do my web forms lose data when I hit the back button?
How can I submit data to a form from a pop-up window?
Configuring htmleditor to do file uploads using php
How can I easily hide / display a form or text on my website?
IE 7 gives me an "Unknown runtime error" when using ajax - how can I fix this?
How can I refresh the parent window from a pop-up
How to include Javascript into your html code



Powered by KnowledgebasePublisher 1.1
Host Gator
Content provided by Roberts WebForge, Inc.