Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

22 of 41 people (54%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

how to detect whether the popup window is open or closed from parent window even it is refreshed

Apr 7th, 2008 23:10
ha mo, Jean-Bernard Valentaten, suresh s,


It depends on whether the parent or the popup window is refreshed.
In the latter case, you only need to check the closed property of the 
popup window:
function isClosed(myWin)
{
  return (myWin?myWin.closed:false);
}
In the first case however, you will have to use a little workaround.
JavaScript has no access to the window-array (for security windows), 
so you can only check whether a child window is open or closed if (and 
only if) you have the window-objects reference (a variable containing 
a reference to the window-object).
As soon as you refresh or reload the page, you loose that reference 
though the child window will stay open.
The only way to avoid loosing the reference and be able to refresh the 
page is to place the page inside a frameset and declare the variable 
used for storing the reference in the head of your frameset. It can 
then be accessed through the parent-object.
HTH,
Jean
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com