Last Updated: February 25, 2016
·
1.356K
· kaareal

Getting the window.onerror message from javascript hosted on a cdn (ff 13+)

When we move all our js scripts to cloudfront, we lost all window.onerror messages, because of the browsers same domain policy.

After doing some digging it turns out if you set the this header on the cdn Access-Control-Allow-Origin : * and add this attribute to your script tag crossorigin. You can make firefox return the full error.

But keep in mind if you set the header with the wrong domain, the crossorigin attribute will make your scripts unload-able.

webkit fix should also be on the way by the way
https://bugs.webkit.org/show_bug.cgi?id=70574

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside