Skip to content

Instantly share code, notes, and snippets.

@karlwestin
Last active December 28, 2015 02:39
Show Gist options
  • Save karlwestin/7430070 to your computer and use it in GitHub Desktop.
Save karlwestin/7430070 to your computer and use it in GitHub Desktop.
Issues with errors from JS files loaded from CDN in Chrome

I've tried to make the window.onerror handler work for cdn-loaded scripts like described here: https://code.google.com/p/chromium/issues/detail?id=159566 but we're still not getting any error messages and stacks.

The page in question is https://www.readyforzero.com/auth#login and we try to load two files: lib__V{hash}.js and auth__V{hash}.js from CDN, and make them report errors via window.onerror.

The script tags has the attribute crossdomain anonymous, and the CDN is instructed to send Access-Control-Allow-Origin: https://www.readyforzero.com (which is also verified).

However we don't see the stacks and error messages in the window.onerror handler

Two questions:

  1. We also load other scripts (typekit, GA), and they don't have ACAO header, could this cause problems?
  2. I see the the browser does not send origin headers for the lib and auth file, could this cause problems and how do i make the browser send origin headers?

See the headers here http://i.imgur.com/n9FWKV6.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment