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
...
The hashchange event is fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the # symbol).
The jQuery Mobile . hashchange() event handler enables very basic bookmarkable #hash history by providing a callback function bound to the window. onhashchange event. The onhashchange event fires when a window's hash changes. In browsers that support it, the native HTML5 window.
You can detect if the browser supports the event by:
if ("onhashchange" in window) { //... }
See also:
onhashchange
without setIntervalwindow.onhashchange
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With