The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, but so far it seems to just effect one user.
我正在处理的项目使用window.onerror事件处理程序来报告用户问题。我注意到单个用户似乎无法加载Google Analytics脚本。我们的网站没有看到很多流量,所以我不确定这是多么广泛,但到目前为止它似乎只影响一个用户。
His user agent is: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17".
The error message Firefox gives is: "Error loading script".
他的用户代理是:“Mozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17)Gecko / 20080829 Firefox / 2.0.0.17”。 Firefox提供的错误消息是:“加载脚本时出错”。
Additional note: The site references several other javascript files. However, the analytics reference is the only one to an external domain and the only script reference at the bottom of the page, just before the closing body tag.
附加说明:该网站引用了其他几个javascript文件。但是,分析引用是唯一一个外部域,并且是页面底部唯一的脚本引用,就在结束正文标记之前。
Has anybody else run across this, or have any idea what could be the issue? Thanks!
有没有其他人遇到这个,或者知道可能是什么问题?谢谢!
5 个解决方案
#1
8
This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.
在所有脚本完成加载之前在Firefox中离开页面时会发生此问题。所以我认为忽略错误是安全的。
You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the alert box for a small amount of time and get the following error in the error console:
您在Firefox错误控制台中没有看到此错误,但您可以通过将警报绑定到window.onerror事件来使其可见。然后,您将能够在短时间内看到警告框,并在错误控制台中收到以下错误:
[11:35:57.428] uncaught exception: [Exception... "prompt aborted by user" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource:///components/nsPrompter.js :: openTabPrompt :: line 462" data: no]
I'm using the following check to ignore this error in my onerror handler:
我正在使用以下检查来忽略我的onerror处理程序中的此错误:
if (navigator.userAgent.search('Firefox') != -1 && message === 'Error loading script') {
// Firefox generates this error when leaving a page before all scripts have finished loading
return;
}
#2
2
This is a rather random guess, but I wonder if the user is using an add-on like NoScript to control script execution and is not allowing scripts from Google Analytics to run. I know this is possible because it's what I do :) I don't know if that would show up as the error you're seeing.
这是一个相当随机的猜测,但我想知道用户是否使用像NoScript这样的插件来控制脚本执行,并且不允许来自Google Analytics的脚本运行。我知道这是可能的,因为这就是我所做的:)我不知道这是否会显示为你所看到的错误。
#3
2
I have a site with over 80 pages, all that employ JavaScript error trapping. My site serves well over 2000 pages a day and I get about ten "Error loading script" scripting errors each day from Firefox browsers. It is beginning to really annoy me and I am becoming convinced that it is a problem in Firefox.
我有一个超过80页的网站,所有这些都使用JavaScript错误捕获。我的网站每天服务超过2000页,我每天从Firefox浏览器获得大约10个“错误加载脚本”脚本错误。它开始真的让我烦恼,我开始相信这是Firefox中的一个问题。
I can discount the NOSCRIPT suggestion because the script loads in the head of my pages where there are no NOSCRIPT tags.
我可以打折NOSCRIPT建议,因为脚本加载在我的页面的头部,其中没有NOSCRIPT标签。
I can discount the 'external domain' suggestion because I have two sites that suffer this problem and in both cases the JS library files are located on the sites own server.
我可以打折'外部域'的建议,因为我有两个遭遇此问题的站点,在这两种情况下,JS库文件都位于站点自己的服务器上。
I have carefully checked every library file and web page using JavaScript Lint and I have discovered scripting errors and questionable scripting techniques. All these problems have been corrected but this has not provided any sort of cure to the "Error loading script" problem.
我使用JavaScript Lint仔细检查了每个库文件和网页,我发现了脚本错误和可疑的脚本技术。所有这些问题都已得到纠正,但这并没有为“错误加载脚本”问题提供任何治疗方法。
My pages do load several JavaScript library files that do not have this problem and the only difference is the size of the files. Most of the files are under 5KB but the problem file is 17KB.
我的页面会加载几个没有此问题的JavaScript库文件,唯一的区别是文件的大小。大多数文件都在5KB以下,但问题文件是17KB。
Could the size of the library file be the problem?
库文件的大小可能是问题吗?
Aagh!
#4
1
We had the same issue and after examining our CDN logs, we discovered that Firefox triggers the onerror event when a script returns with HTTP status "304 Not Modified", so a cache hit. In fact, Firefox (tested with Firefox 12 at time of this writing), seems to trigger onerror event for all HTTP statuses except '200 Ok'. Other browsers behaved differently in our experiment: Chrome (19) triggered onerror only on '407 Proxy Authentication Required' and Opera (12) on 100, 101, 204, 4xx and 5xx.
我们遇到了同样的问题,在检查了我们的CDN日志之后,我们发现当脚本以HTTP状态“304 Not Modified”返回时,Firefox会触发onerror事件,因此缓存命中。实际上,Firefox(在撰写本文时使用Firefox 12测试过)似乎会触发除“200 Ok”之外的所有HTTP状态的onerror事件。其他浏览器在我们的实验中表现不同:Chrome(19)仅在“需要407代理身份验证”和100(101,204,4xx和5xx)上的Opera(12)上触发错误。
#5
0
I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the script, so I suggest looking at your logs as one possibly source of this error.
我确信这个问题已经解决了很长时间..但对于那些偶然发现此页面的人来说:当外部脚本无法加载时,firefox会触发此错误(很容易找到在源代码中触发此代码的代码)。我们在我们的网站上发现了这些错误,事实证明我们正在为脚本返回404,因此我建议将您的日志视为此错误的可能来源。
#1
8
This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.
在所有脚本完成加载之前在Firefox中离开页面时会发生此问题。所以我认为忽略错误是安全的。
You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the alert box for a small amount of time and get the following error in the error console:
您在Firefox错误控制台中没有看到此错误,但您可以通过将警报绑定到window.onerror事件来使其可见。然后,您将能够在短时间内看到警告框,并在错误控制台中收到以下错误:
[11:35:57.428] uncaught exception: [Exception... "prompt aborted by user" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource:///components/nsPrompter.js :: openTabPrompt :: line 462" data: no]
I'm using the following check to ignore this error in my onerror handler:
我正在使用以下检查来忽略我的onerror处理程序中的此错误:
if (navigator.userAgent.search('Firefox') != -1 && message === 'Error loading script') {
// Firefox generates this error when leaving a page before all scripts have finished loading
return;
}
#2
2
This is a rather random guess, but I wonder if the user is using an add-on like NoScript to control script execution and is not allowing scripts from Google Analytics to run. I know this is possible because it's what I do :) I don't know if that would show up as the error you're seeing.
这是一个相当随机的猜测,但我想知道用户是否使用像NoScript这样的插件来控制脚本执行,并且不允许来自Google Analytics的脚本运行。我知道这是可能的,因为这就是我所做的:)我不知道这是否会显示为你所看到的错误。
#3
2
I have a site with over 80 pages, all that employ JavaScript error trapping. My site serves well over 2000 pages a day and I get about ten "Error loading script" scripting errors each day from Firefox browsers. It is beginning to really annoy me and I am becoming convinced that it is a problem in Firefox.
我有一个超过80页的网站,所有这些都使用JavaScript错误捕获。我的网站每天服务超过2000页,我每天从Firefox浏览器获得大约10个“错误加载脚本”脚本错误。它开始真的让我烦恼,我开始相信这是Firefox中的一个问题。
I can discount the NOSCRIPT suggestion because the script loads in the head of my pages where there are no NOSCRIPT tags.
我可以打折NOSCRIPT建议,因为脚本加载在我的页面的头部,其中没有NOSCRIPT标签。
I can discount the 'external domain' suggestion because I have two sites that suffer this problem and in both cases the JS library files are located on the sites own server.
我可以打折'外部域'的建议,因为我有两个遭遇此问题的站点,在这两种情况下,JS库文件都位于站点自己的服务器上。
I have carefully checked every library file and web page using JavaScript Lint and I have discovered scripting errors and questionable scripting techniques. All these problems have been corrected but this has not provided any sort of cure to the "Error loading script" problem.
我使用JavaScript Lint仔细检查了每个库文件和网页,我发现了脚本错误和可疑的脚本技术。所有这些问题都已得到纠正,但这并没有为“错误加载脚本”问题提供任何治疗方法。
My pages do load several JavaScript library files that do not have this problem and the only difference is the size of the files. Most of the files are under 5KB but the problem file is 17KB.
我的页面会加载几个没有此问题的JavaScript库文件,唯一的区别是文件的大小。大多数文件都在5KB以下,但问题文件是17KB。
Could the size of the library file be the problem?
库文件的大小可能是问题吗?
Aagh!
#4
1
We had the same issue and after examining our CDN logs, we discovered that Firefox triggers the onerror event when a script returns with HTTP status "304 Not Modified", so a cache hit. In fact, Firefox (tested with Firefox 12 at time of this writing), seems to trigger onerror event for all HTTP statuses except '200 Ok'. Other browsers behaved differently in our experiment: Chrome (19) triggered onerror only on '407 Proxy Authentication Required' and Opera (12) on 100, 101, 204, 4xx and 5xx.
我们遇到了同样的问题,在检查了我们的CDN日志之后,我们发现当脚本以HTTP状态“304 Not Modified”返回时,Firefox会触发onerror事件,因此缓存命中。实际上,Firefox(在撰写本文时使用Firefox 12测试过)似乎会触发除“200 Ok”之外的所有HTTP状态的onerror事件。其他浏览器在我们的实验中表现不同:Chrome(19)仅在“需要407代理身份验证”和100(101,204,4xx和5xx)上的Opera(12)上触发错误。
#5
0
I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the script, so I suggest looking at your logs as one possibly source of this error.
我确信这个问题已经解决了很长时间..但对于那些偶然发现此页面的人来说:当外部脚本无法加载时,firefox会触发此错误(很容易找到在源代码中触发此代码的代码)。我们在我们的网站上发现了这些错误,事实证明我们正在为脚本返回404,因此我建议将您的日志视为此错误的可能来源。