[Javascript] window.close () not catched

Nick Fitzsimons nick at nickfitz.co.uk
Mon Apr 24 10:38:22 CDT 2006


Guillaume wrote:
> A new window is opened with an inline window.open JavaScript ( 
> target="_blank"  refuses to pass Xhtml validation).
> Trying to close this opened window with...
> 
> <a href="#" onclick="window.close()">Close</a>
> 
> ... is working fine.

> Except in Safari: this browser allows the window.close only when the 
> window is opened first.
> If you browse to the second image inside this window the window.close 
> does not work anymore...

As you haven't posted a link to a testcase I've tried to replicate this 
(using Safari 2.0.3) and can't.

You can find my test pages at:
<http://www.nickfitz.co.uk/bugs/browsers/javascript/safari/>
and see if it gives you any clues as to why it works fine for me but not 
for you, but without a live example to look at, and details such as 
which version of Safari, it's not really possible to suggest a fix. Have 
you tried enabling the Safari Debug menu (if not already enabled) and 
then enabling "Log JavaScript Exceptions"? If you do that you can look 
in the console logs to find any JS error messages Safari may be giving you.

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/





More information about the Javascript mailing list