Rabu, 07 November 2012

Handling Event Window Close or Reload With jQuery

Handling Event Window Close or  Reload With jQuery

         When we want to know that the user will leave the pages of the website, we need a trigger that can be used as a reference to determine the user has left the website pages.
There are some conditions in which the user can leave the web page:

- Refresh or reload page
- Back to previous page
- Close page

example with javascript:
window.onunload=function(){SomeJavaScriptCode};

example with jquery
$(window).unload(function() {
    //some javascript code
}

Some Problem :
onUnload only working on Firefox , Internet Explorer and Opera

Tidak ada komentar:

Posting Komentar