[jQuery] Trapping the forward and back buttons and other navigation events

[jQuery] Trapping the forward and back buttons and other navigation events


I'm trying to trap navigation off of a web page so that the user is
presented with a warning dialog before allowing the departure event
to continue. Specifically, I need to trap the forward button, the
back button, and clicking on a link, but I don't want to trap closing
the browser or a tab.
I know how to use window.onbeforeunload() to do what I want, with the
exception that this also nags the user on browser and tab closing
events, and I'd like to fix this misfeature. Any ideas would be
muchly appreciated.
Thanks,
|>oug
P.S. Yes, I know that trapping navigation is annoying to the user, but
I haven't yet implemented persistence of the page state, so I'm sure
this work-around will be less annoying to them than it would be for
them to lose their work without warning.