Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1475 How do I show a confirm box when the user closes their browser manually as I'd like to remind users to log out of my webpage properly before closing their browser?

irt.org | Knowledge Base | JavaScript | Window | Q1475 [ previous next ]

Q1475 How do I show a confirm box when the user closes their browser manually as I'd like to remind users to log out of my webpage properly before closing their browser?

By then it would be too late. The only event is the onUnload event and that is triggered even when they leave the page for another one of your pages. You would need to have a test in every link on your page:

<BODY onLoad="closing=true" onUnload="if (closing) alert('please leave next time by logging off')">

<a HREF="otherpage.html" onClick="closing=false">other page</a>

Feedback on 'Q1475 How do I show a confirm box when the user closes their browser manually as I'd like to remind users to log out of my webpage properly before closing their browser?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.