By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,843 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,843 IT Pros & Developers. It's quick & easy.

window close event

P: n/a
Hello all,

I want to trap the window.close() event when the user clicks on the
close button of the browser using javascript.
Can anyone shed light on this problem ?

Thanks in advance.

regards
casper
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ca*********@rediffmail.com (abhay) writes:
I want to trap the window.close() event when the user clicks on the
close button of the browser using javascript.


Can't be done consistently across browsers.
In IE, you can use the proprietary "onbeforeunload" handler to
do something before the window is closed. You can even request
that the window is not closed, by returning a string. That string
is shown to the user, who can then decide whether to close the
window or not.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.