Hello! I wrote a module under Jumla, which, when closing a tab with a site page, displays a warning message, and a form in which the user indicates the reason for leaving the site. Made according to the principle as here - http://stopexit.ru/
The question is how to make the window closing event work exactly at closing, and not when clicking on the internal links of the site menu ...
this is event code for window on jquery
window.onbeforeunload = function(e){ if($j.cookie('sendForm')==1){ window.onbeforeunload = null; }else{ e = e || window.event; // For IE and Firefox prior to version 4 if(e){ e.returnValue = _onbefore; } openForm(); return _onbefore; // For Safari } };
Here is the site on which this module http://g-idea.ru/, when navigating through the items in the top menu, a message flies all the same. I read about this event and when it works:
Actions causing this event
Go to another page directly in the browser or through a link. Close the current window in a browser or bookmark. Reload current page. Manipulating the URL of the loaded page using the location object in JavaScript. The window.navigate method. Method window.open or document.open to open a document in the same window
Ie, in fact, everything works correctly! But how on http://stopexit.ru/demo.html when you go to the internal links window does not crash?