ReferenceError: Can't find variable: __gCrWeb

后端 未结 1 2016
孤城傲影
孤城傲影 2021-02-01 02:27

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

R

相关标签:
1条回答
  • 2021-02-01 03:19

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

    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:

    https://docs.sentry.io/clients/javascript/config/

    https://rollbar.com/docs/notifier/rollbar.js/#ignoring-specific-exception-messages

    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'] = {};
    

    just like Google does it.

    0 讨论(0)
提交回复
热议问题