Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: Can't find variable: __gCrWeb

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'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?

like image 406
Tzach Avatar asked Oct 21 '14 09:10

Tzach


1 Answers

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

like image 169
Bruno Avatar answered Nov 05 '22 11:11

Bruno