In article <bd**********@news.eusc.inter.net>, DU <dr*******@hotREMOVEmail.com>
writes:
Check the FAQ on this.
http://jibbering.com/faq/
A window not opened by javascript can NOT be closed by javascript
because it can not be referenced with client-side javascript.
http://tinyurl.com/fiyh
Is one of many threads that discusses where it *does* work. The list
of browsers where it works seems to be growing. Perhaps its time
to add it to the FAQ?
This script:
window.opener = window;
window.close();
Results:
PC browsers:
Netscape 4.06 - Prompts the user about trying to close a window (I didn't see
this message, someone else tested it for me).
Netscape 4.80 - closes window without a prompt.
IE5.0 - prompts the user.
IE5.5 - Cant find anyone who has IE5.5 so untested there.
IE6.0 - closes window without a prompt.
Netscape 7 - closes the window without a prompt.
Opera 7 - closes the window without a prompt.
Phoenix 0.5 - closes the window without a prompt.
Mozilla 1.4 - No prompt, just an error message "Scripts may not close windows
that were not opened by script." in the Javascript console.
MAC browsers:
AOL For Mac OSX v. 10.3 - closes the window without a prompt
IE 5.2.2 for Mac - closes the window without a prompt
Netscape 7.02 for Mac OSX Does nothing, and after attempting to open,
Netscape must be rebooted
I am not the one testing on the MAC so not sure exactly what NS7.02 is doing
there. Also, it has been tested in the past in OmniWeb on a MAC and it closes
the window without a prompt but do not know the version that was used.
The results seem to indicate that the statement "javascript can't close a
window that it didn't open" a false statement, within a very few limitations.
Namely, Mozilla on a PC, preIE5.5 on PC and NS7 on the MAC. Other than that,
yes, I *can* close a window that script didn't open.
The only one I tested it in that actually surprised me was NN4.80 where it
works.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.