http://docs.jquery.com/Events/unload#fn
jQuery:
$(window).unload( function () { alert("Bye now!"); } );
or javascript:
window.onunload = function(){alert("Bye now!");}
More Related Contents:
- jQuery .live() vs .on() method for adding a click event after loading dynamic html
- jQuery Event Keypress: Which key was pressed?
- How to capture the browser window close event?
- Definitive way to trigger keypress events with jQuery
- How to order events bound with jQuery
- Firing event on DOM attribute change
- Can I call jQuery’s click() to follow an link if I haven’t bound an event handler to it with bind or click already?
- How to trigger the window resize event in JavaScript?
- How do you log all events fired by an element in jQuery?
- How to unbind a listener that is calling event.preventDefault() (using jQuery)?
- Handling key-press events (F1-F12) using JavaScript and jQuery, cross-browser
- Jquery: change event to input file on IE
- Preventing click event with jQuery drag and drop
- jQuery: How to get the event object in an event handler function without passing it as an argument?
- Attach an event in a child iframe to a handler in the parent window
- Javascript with jQuery: Click and double click on same element, different effect, one disables the other
- jQuery: Unbind event handlers to bind them again later
- How do you detect the clearing of a “search” HTML5 input?
- JS Events: hooking on value change event on text inputs
- jQuery prevent change for select
- jQuery event that triggers after CSS is loaded?
- jQuery events .load(), .ready(), .unload()
- Performance difference between jQuery’s .live(‘click’, fn) and .click(fn)
- Get the clicked object that triggered jquery blur() event [duplicate]
- Drop event not firing in chrome
- Prevent onclick action with jQuery
- List all javascript events wired up on a page using jquery
- jQuery: How to listen for DOM changes?
- jquery/javascript: function(e){…. what is e? why is it needed? what does it actually do/accomplish?
- Unloading/Removing content from an iFrame