Firefox“加载脚本时出错”在FF2中加载Google Analytics [英] Firefox 'Error loading script' loading Google Analytics in FF2

查看:112
本文介绍了Firefox“加载脚本时出错”在FF2中加载Google Analytics的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理的项目使用window.onerror事件处理程序来报告用户问题。我注意到一个用户似乎无法加载Google Analytics(分析)脚本。我们的网站没有看到很多的流量,所以我不知道这是多么广泛,但到目前为止,似乎只是影响一个用户。他的用户代理是:Mozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17)Gecko / 20080829 Firefox / 2.0。 0.17。

Firefox给出的错误信息是:加载脚本时出错。

其他注意事项:网站引用其他几个JavaScript文件。然而,分析引用是唯一一个外部域名,也是页面底部的唯一脚本引用,位于关闭body标签之前。



其他人碰到这个,或者有什么想法可能是什么问题?谢谢!

解决方案

在所有脚本完成加载之前,在Firefox中离开页面时会发生此问题。所以我认为忽略错误是安全的。

在Firefox错误控制台中没有看到这个错误,但是可以通过绑定一个警报到window.onerror事件。然后,您将能够在少量时间内看到警报框,并在错误控制台中获得以下错误:

  [11:35:57.428]未捕获异常:[异常...]提示由用户中止nsresult:0x80040111(NS_ERROR_NOT_AVAILABLE)位置:JS frame :: resource:///components/nsPrompter.js :: openTabPrompt: :line 462data:no] 

我使用以下检查来忽略这个错误onerror handler:

  if(navigator.userAgent.search('Firefox')!= -1&& message == ='加载脚本时出错'){
// Firefox在所有脚本加载完成之前离开页面时产生这个错误
return;
}


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.

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".

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.

Has anybody else run across this, or have any idea what could be the issue? Thanks!

解决方案

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.

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:

[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:

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;
}

这篇关于Firefox“加载脚本时出错”在FF2中加载Google Analytics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆