SyntaxFix
Write A Post
Hire A Developer
Questions
Use onunload.
For jQuery, I think this works like so:
$(window).unload(function() { alert("Unloading"); return falseIfYouWantToButBeCareful(); });