Modify ↓
Ticket #5538 (closed bug: worksforme)
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 3 years ago by dmethvin
- Status changed from new to closed
- Resolution set to worksforme
- Component changed from unfiled to event
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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.