Reputation: 14033
I have the following code:
<html>
<head>
<title>D</title>
<script type="text/javascript" src="jQuery.js">
<script type="text/javascript">
$(window).unload( function () { alert("Bye now!"); } );
</script>
</head>
<body>
<span>Hello world</span>
</body>
</html>
But this doesn't show anything.
[Edit] There are two things:
Upvotes: 2
Views: 1650
Reputation: 189
use
<script>window.onbeforeunload = function(){ return 'Your Returned String Goes Here';}/script>
Upvotes: 0
Reputation: 50976
jQuery's .unload()
event doesn't work in Google Chrome 14 and above. This is new reported bug. (13 days old)
That is probably just a security measure from Google's side
Upvotes: 4