Greg's Blog

helping me remember what I figure out

Prompting When Leaving the Page

| Comments

Over at 4 Guys from Rolla there is a really useful technique that takes advanatge of the onbeforeunload javascript event to prompt a user that he is leaving a page. The author goes into even more detail on how to use this event to check if any changes were made and then prompt the user to save these or these will be lost. Very neat, though it’s worth pointing out, it only works with the latest browser version (inlcusing FireFox 0.9 and higher).