Unload Event
Does anyone know how google/gmail gets the confirm window to come up before the window closes? I thought it was onunload but that's not working on my page, it closes then the confirm comes up. I want the user to know there changes will be lost if they close the window, this works for refreshes but not ctrl (command/apple) + W ( I assume clicking the X in the browser to but havent tried).
Code:
<body onUnload="javascript: confirm('You are leaving the page, all data changes will be lost. Are you sure?')">
Thanks for any ideas.
Corrections to my coding/thoughts welcome.
Bookmarks