|
||||||||||||
Is my window still open?Question: How do I test whether my other window is still open?
Answer:
Let's assume that you opened a new browser window
using the winRef = window.open( URL, name, features )Later on, you can check whether this window is still open by using the window.closed property:
if (winRef.closed) alert ("It's closed!") else alert ("It's still open!")The window.closed property is not supported in
Netscape Navigator 2 or Internet Explorer 3. To avoid error messages,
you can place the above code within a conditional statement as follows:
if (parseInt(navigator.appVersion>2)) { if (winRef.closed) alert ("It's closed!") else alert ("It's still open!") }(Internet Explorer 3 reports that its version is 2, so the condition involving navigator.appVersion
will be true for Navigator 3 and higher and Internet Explorer 4 and higher.)
There is no simple workaround for old browsers.
You might want to emulate the
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov
|