ReferenceError:找不到变量:__ gCrWeb [英] ReferenceError: Can't find variable: __gCrWeb

查看:92
本文介绍了ReferenceError:找不到变量:__ gCrWeb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有javascript错误跟踪。最近我开始在iPhone(IOS 7和8)上从Chrome(版本37和38)收到以下错误:

I have javascript error tracking on my website. Recently I started getting the following error from Chrome (versions 37 and 38) on iPhone (IOS 7 and 8):


ReferenceError:Can'找到变量:__ gCrWeb

ReferenceError: Can't find variable: __gCrWeb

除了一些引用之外,我找不到任何有关此错误的有用信息。有没有人见过它,知道它为什么会发生?

I couldn't find any useful information about this error except for a few references. Has anyone seen it before and knows why it happens?

推荐答案

__ gcrweb gcrweb.js 的引用,它是由iOS版Chrome注入的本地(在设备上)js。

__gcrweb is a reference by gcrweb.js, which is a local (on device) js getting injected by the iOS version of Chrome.

Google需要针对某些扩展功能执行此操作(主要是插入/检索您通过其他已同步的Chrome浏览器存储的登录凭据和其他表单信息),这些信息不是由其构建的本机webview提供的,无法添加否则。

Google needs to do this for some extended functionality (mostly inserting/retrieving login credentials and other form information you stored via another synced Chrome browser) which isn't provided by the native webview it's built on and can't be added to it otherwise.

这不应该影响你代码的任何部分,我会在你的错误记录中忽略它来消除它(错误应该始终是相同的字符串),例如:

This should not affect any parts of your code and i'd get rid of it by ignoring it in your error logging (the error should always be the same string), for example:

http://raven-js.readthedocs.org/en/latest/config/#ignoreerrors
https://rollbar.com/docs/notifier/rollbar.js/#ignoring-specific-exception-messages

另一种解决方案可以通过在js init的开头自己声明引用来确保引用始终存在

Another solution could be to make sure that the reference always exists by declaring it yourself at the beginning of your js init

if (!window.__gCrWeb) window['__gCrWeb'] = {};

就像 Google做到了。

这篇关于ReferenceError:找不到变量:__ gCrWeb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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