Search code examples
javascriptjqueryhashchange

Jquery hashchange problems in firefox


I am having a problem with the hashchange event in Firefox. We are using the JQuery hashchange plugin provided by Ben Alman. The code is as follows.

$(window).hashchange(function (e) {
    alert("Hello");
    //we want to perform a post in here.
});
var temp = "#123";
if (temp !== "") {
    if (window.location.hash == temp) {
        $(window).hashchange();
    } 
    else{
        window.location.hash = temp;
    }
} 
else {
    window.location.hash = "#Home/Home";
};

Now this works fine in IE9 and Chrome, however in Firefox, I see the alert, but as soon as I click OK, the page refreshes, displays the alert again, and continues infinitely. Is there some sort of weird behaviour that Firefox uses that I am unaware of? Or is there simply some other problem that is hidden deeper?


Solution

  • We located the problem as occuring in MicrosoftAjax.js and found the following solution: Firefox 6 Infinite Page Refresh With Page With Hash Tags