Last Updated: February 25, 2016
·
1.197K
· 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