as i searched quite for this issue, including google chrome support sites, Chrome Bug Issues, as they are not yet fixed the problem. Right now i have a situation where i should use onuload or onbeforeunload event in my JS Snippets, as its working nicely in other browsers. these are the things which i’ve tried of now
- using Page Hide or PageShow as Webkit provides alternative to this problem, but the result is same, chrome is not firing the onpagehide event only. after bit of exploration i come to know pagehide and pageshow methods are applicapble to firefox only.
- Secondly i tried setting Async=false, as suggested in this answer OnUnload .
- I’m using Chrome Dev.Version (17.0.963.12 dev-m).
Is there any work around for this weird problem, i hope anyone already experienced the same problem, and they may got some alternative.
<html>
<script type="text/javascript" >
function DoSomethingonUnload()
{
alert ('im unloading');
}
</script>
<body onunload="DoSomethingonUnload();"> //need alternative which can work in (ie,chrome,ff)
</body>
</html>
Using jQuery, I achieved this task. Using Bind function with onbeforeunload event jQuery bind . it works seamlessly 🙂 🙂 thank you @ Sergey Ratnikov