Thursday, March 30, 2006

onBeforeUnload event

As most of people I thought that onBeforeUnload event is not supported by Mozilla browsers because it contradicts to purists view on how Internet page should behave. But it turned out that I'm wrong! Even people from Mozilla developers team recognized an importance of this event for Web Application (do not mix this term with a regular Web page). For example it allows to ask user if he wants to leave a page without saving a modified data. Even more, it allows to stay on a page until user agrees to leave.
However, Microsoft in its usual intentional ignorance of the fact that more and more people using other browsers (Firefox/Mozilla) provides a proprietary non-standard example of using onBeforeUnload event on their page. And most people still follow that bad approach and think that only IE supports this feature.
That's wrong! Here's an example which works with Mozilla/Firefox as well! Please try it and think if it could be helpful to use on your company's web site.