Any ideas how to intercept the browser back button via jQuery, so I can run my event function? I don\'t need to use jQuery BBQ or jQuery Address, only prevent the default be
In jQuery land:
$(window).unload( function () { /*code here*/ });
EDIT- There was a parentheses instead of a close bracket
EDIT - Removed Extra Semicolin
Have not tried but i guess this do what you want.
window.onbeforeunload = function () {
// stuff do do before the window is unloaded here.
}
with jQuery you could try the .unload() function
The unload event is sent to the window element when the user navigates away from the page. This could mean one of many things. The user could have clicked on a link to leave the page, or typed in a new URL in the address bar. The forward and back buttons will trigger the event. Closing the browser window will cause the event to be triggered. Even a page reload will first create an unload event.