jQuery - hashchange event
browser-state, hashchange, javascript, jquery
Solution
You can detect if the browser supports the event by:
if ("onhashchange" in window) {
//...
}
See also:
- Detecting event support without browser sniffing
- Emulating `onhashchange` without setInterval
- `window.onhashchange`
Problem
I am using: ``` $(window).bind( 'hashchange', function(e) { }); ``` to bind a function to the hash change event. This seems to work in IE8, Firefox and Chrome, but not in Safari and I assume not in earlier version of IE. For these browsers, I want to disable my JavaScript code that uses the hash and `hashchange` event. Is there a way with jQuery that i can detect if the browser supports the `hashchange` event? Maybe something with `jQuery.support`...