Bug Tracker

Ticket #5538 (closed bug: worksforme)

Opened 5 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

Change History

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme
  • Component changed from unfiled to event

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.

comment:2 Changed 3 years ago by dynamodan

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.

comment:3 Changed 3 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.