Skip to main content

Bug Tracker

Side navigation

#5538 closed bug (worksforme)

Opened November 20, 2009 04:52PM UTC

Closed June 13, 2010 06:45PM UTC

Last modified March 10, 2012 09:23AM UTC

jQuery unload method not working Cross browser

Reported by: valugi Owned by:
Priority: minor Milestone: 1.4
Component: event Version: 1.3.2
Keywords: unload Cc:
Blocked by: Blocking:
Description

I have this simplified code:

$(document).ready(function(){

$(window).unload(function (){

alert('disconnect');

});

});

The jQuery method should work in all jQuery supported browsers.

The alert works in Safari, Chrome, FF on Windows

The alert is not poping on working in Mac FF, Opera, IE8.

The alert should pop up before closing the window.

I also put an example online.

http://pastebin.me/b48ec58f7340cd1baf8f144ef152af57

Attachments (0)
Change History (3)

Changed June 13, 2010 06:45PM UTC by dmethvin comment:1

component: unfiledevent
resolution: → worksforme
status: newclosed

This works for me with jQuery 1.4 in IE8. The unload event doesn't fire on the back button, but this is true even if you assign to window.onunload so it's not a jQuery issue.

Changed February 14, 2012 09:30PM UTC by dynamodan comment:2

This is broken again. It is not working in Google Chrome 17.0.963.46. It works in IE8 and FF 9.01. I haven't tested any others.

Changed February 14, 2012 09:34PM UTC by dmethvin comment:3

The variable would seem to be Chrome's new version then, please report it to them (with a test case of course) and it'll be fixed in 6 weeks or less.