Jul 18, 2004 #1 mooster2 Programmer Jan 26, 2004 21 CA Hi, Is it possible in Javascript to display an alert when the user tries to close a window? Something like "Are you sure you want to close this window?"
Hi, Is it possible in Javascript to display an alert when the user tries to close a window? Something like "Are you sure you want to close this window?"
Jul 18, 2004 2 #2 starrwriter Programmer Jun 16, 2004 8 US This may only work in Internet Explorer, but place this script in the head section: <SCRIPT LANGUAGE="JScript" TYPE="text/javascript" FOR=window EVENT=onbeforeunload> mess = "ADDITIONAL MESSAGE OPTIONAL HERE" return mess; </SCRIPT> Upvote 0 Downvote
This may only work in Internet Explorer, but place this script in the head section: <SCRIPT LANGUAGE="JScript" TYPE="text/javascript" FOR=window EVENT=onbeforeunload> mess = "ADDITIONAL MESSAGE OPTIONAL HERE" return mess; </SCRIPT>
Jul 19, 2004 #3 glenmac Technical User Jul 3, 2002 947 CA Thanks Starrwriter a star for you. Glen http://lantzvillecomputers.ca Upvote 0 Downvote
Jul 29, 2004 Thread starter #4 mooster2 Programmer Jan 26, 2004 21 CA That's very neat I'll award a star too Upvote 0 Downvote
Jul 29, 2004 #5 jemminger Programmer Jun 25, 2001 3,453 US this should work in IE and Mozilla (or at least firefox) <body onbeforeunload="return 'your message here';"> ========================================================= -jeff http://www.jeffemminger.comtry { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); } Upvote 0 Downvote
this should work in IE and Mozilla (or at least firefox) <body onbeforeunload="return 'your message here';"> ========================================================= -jeff http://www.jeffemminger.comtry { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }