Search code examples
javascriptjqueryjquery-pluginsjquery-eventshashchange

Jquery + up to date hash change listener?


I'm using http://benalman.com/projects/jquery-hashchange-plugin/ to listen for hash changes in my project, but his plugin is outdated and does not work with newer versions of browsers such as Firefox 9 and IE9.

Searched on Google and here but could not find any other plugin.

Or is it enough to just use this code to target most of the browsers?

$(window).bind('hashchange', function() {
    //code
});

EDIT: Seems like there was a problem regarding console.log() on these browsers and had nothing to do with the hashchange. It works like expected after removing all console.log output


Solution

  • Plugin you are using is still the best one available. For IE9 support check out this. Also consider some alternative for browsers that do not support hash change event (this may help).