Firefox 6 无限页面刷新,页面带有哈希标签 [英] Firefox 6 Infinite Page Refresh With Page With Hash Tags
问题描述
最近当 Firefox 更新到第 6 版时,我正在处理的一个网站严重崩溃.
When Firefox updated to version 6 recently, a site I'm working on severely broke.
当浏览到任何没有散列标签的页面时,网站正常运行,但如果您尝试导航到带有散列标签(例如#test
)的页面或刷新页面一旦应用了哈希标签,页面就会以无限的速度刷新.
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.
这是一个大约一年半前创建的 Asp.Net MVC 2 站点.
This is a Asp.Net MVC 2 site created around a year and a half ago.
推荐答案
事实证明,这是旧版本的 MicrosoftAjax.js(随 Asp.Net MVC 2 一起安装的版本)的问题.
Turns out, this is an issue with an old version of MicrosoftAjax.js (the one that comes installed with Asp.Net MVC 2).
打开 MicrosoftAjax.debug.js 文件并检查文件版本号.如果这是您的问题,此文件的顶部将如下所示:
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
这是包含此错误的版本.在撰写本文时,最新的文件版本是 4.0.30205.0.升级到最新版本,问题就会消失.正如 Nathan Fox 在评论中提到的,我从 Microsoft CDN,更具体地说是 缩小 和 调试 个版本.
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.
出于好奇,我在 javascript 文件中追踪了问题.
For the curious, I traced the problem down in the javascript file.
有问题的版本包括:
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();
}
这篇关于Firefox 6 无限页面刷新,页面带有哈希标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!