42

When Firefox updated to version 6 recently, a site I'm working on severely broke.

The site operates normally when browsing to any page without a hash tag but if you try to navigate to a page with a hash tag (e.g. #test) or refresh the page once a hash tag was applied, the page refreshes as quickly as it can infinitely.

This is a Asp.Net MVC 2 site created around a year and a half ago.

frank hadder
  • 4,384
  • 1
  • 31
  • 30

2 Answers2

67

Turns out, this is an issue with an old version of MicrosoftAjax.js (the one that comes installed with Asp.Net MVC 2).

Open up the MicrosoftAjax.debug.js file and check the file version number. The top of this file will look like this if this is your problem:

 // Name:        MicrosoftAjax.debug.js
 // Assembly:    System.Web.Extensions
 // Version:     4.0.0.0
 // FileVersion: 4.0.20526.0

That's the version that contains this bug. The latest file version as of this writing is 4.0.30205.0. Upgrade to the latest version and the problem goes away. As mentioned in a comment by Nathan Fox, I got the latest version from the Microsoft cdn and more specifically the minified and debug versions.

For the curious, I traced the problem down in the javascript file.

The buggy version includes:

 if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash && (!window.frameElement || window.top.location.hash)) {
      window.history.go(0);
 }

Which was corrected to the following in the newer version:

 if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash && (!window.frameElement || window.top.location.hash)) {
      (Sys.Browser.version < 3.5) ?
      window.history.go(0) :
      location.hash = this.get_stateString();
 }
Community
  • 1
  • 1
frank hadder
  • 4,384
  • 1
  • 31
  • 30
  • 4
    Wow. Thanks for this. I had this problem a few days ago and didn't expect the javascript to be the issue... by happy chance I found this question and woot, now it's fixed. – smdrager Aug 23 '11 at 15:10
  • Thanks for figuring this out, this saved me a ton of time! – Nathan Fox Aug 23 '11 at 15:27
  • You can find links to the latest .js files on the MS CDN page at http://www.asp.net/ajaxlibrary/CDNAjax4.ashx . – Nathan Fox Aug 23 '11 at 17:12
  • I have exactly the same symptoms but I use jQuery instead of MicrosoftAjax.debug.js. Do you know any solutions for it? – TOUDIdel Aug 31 '11 at 07:20
  • 1
    This problem/solution is specifically about MicrosoftAjax. You don't have to use it but if it's referenced on the page at all, this problem will happen. If it's not referenced at all, then I don't know =) – frank hadder Sep 09 '11 at 06:04
  • Here's another question - how would developers know about it, know that they have to update that one library. where is the update notes? anybody able to find them? – Artemiy Nov 22 '11 at 17:02
  • Somehow, we're just now fixing this. Thank you! – Jaxidian Jan 02 '13 at 21:29
3

Deleting MicrosoftAjax.js or MicrosoftAjax.debug.js may help, but just replacing the files with the current versions from http://www.asp.net/ajaxlibrary/CDNAjax4.ashx will do the job, too!

Chris
  • 721
  • 1
  • 10
  • 23