[Javascript] window.close () not catched

Nick Fitzsimons nick at nickfitz.co.uk
Mon Apr 24 15:11:48 CDT 2006


Guillaume wrote:
> 
> Thanks Nick.
> 
> Guillaume.

No problem. FWIW I tested your page and Safari didn't give any error 
message, and didn't close the window with the second page loaded :-(

So I'm not sure what's going on, and unfortunately I'm pretty busy so 
can't really look into it at the moment.

One possible way of investigating is to assign an id attribute to the link:

<a href="#" onclick="window.close();return false;" id="testLink">

which would then allow you to type the following into the location bar:

javascript:alert(document.getElementById("testLink").onclick.toString())

which would allow you to see if the link is actually losing its click 
event handler, or what. If you get an alert saying 
"window.close();return false;" then try:

javascript:void(document.getElementById("testLink").click())

and see if the window closes. If so the implication is that somehow the 
click is being blocked from getting through to the button - maybe a 
layout problem...

HTH,

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





More information about the Javascript mailing list