I have the following code
$(document).ready(function() {
if (\"onhashchange\" in window) {
alert(\"The browser supports the hashchange event!\");
See this: link
Does the browser support window.onhashchange?
Note that IE8 running in IE7 compatibility mode reports true for 'onhashchange' in window,
even though the event isn't supported, so also test document.documentMode
.
var docmode = document.documentMode;
if ('onhashchange' in window && (docmode === undefined || docmode > 7 )) {
window.onhashchange = checkHash;
}