How to use javascript to detect users operation on browsers such as click backward/forward/refresh button, keyboard inputs in navigation bar or search bar of Firefox, as well as any hotkeys for these operations.
Thanks! Paul
How to use javascript to detect users operation on browsers such as click backward/forward/refresh button, keyboard inputs in navigation bar or search bar of Firefox, as well as any hotkeys for these operations.
Thanks! Paul
Well, for mouse/keyboard events on the page's DOM or the window, you can detect. The easiest way for me is using JQuery's event: http://docs.jquery.com/Events
Anything else e.g clicks on the browser toolbars/search boxes/3rd party components will be highly unlikely (I'm hesistant to say 100%).
Navigation of pages/url can be detected as well but not necessarily identified as back/forward or refresh.
You can't. Anything that happens outside the page content area is completely off-limits to scripting. (Thank God... it would be a security and usability disaster.)
About the only information you can get is that if an unload
event happens without a link being clicked/form submitted, the user did some kind of navigation outside the page (such as window close, bookmark open, address entered, back/forward/etc). And if you really want to be obnoxious you can detect/prevent browser-specific navigation keystrokes like F5-for-refresh when the focus is in the window.