Enable Error Reporting
window.onerror event, this setting can interfere with Browser RUM error capture. See Handle the window.onerror Event to learn how to catch those errors.
By default and for security reasons, most modern browsers do not provide access to the error information in
window.onerror for scripts that are loaded from other domains. To access this error information, you need to enable cross-origin resource sharing (CORS). Firefox and Chrome both allow you to enable CORS by making small changes to your server and
script element in your HTML.
If you have not enabled CORS, you will only see the error message "CROSSORIGIN" shown below:
Once CORS is enabled, you will able to see error details like those shown here.
In the following sections, we're going to show you how to make changes to access the error information in
window.onerror cross-domain scripts.
To enable CORS, you need to add this header to responses that are not from the same domain as the caller:
Script Tag Change
script element has a new non-standard attribute called
crossorigin. The most secure value for
crossorigin would be
anonymous. So, you'll have to modify your script tags to look like the following.
Browser Support for CORS
In the future, we expect most browsers to enable CORS. Internet Explorer 10+ already has native support for CORS and reports errors to
window.onerror for both local and cross-domain scripts. See CORS: Browser support to see a list of browsers/layout engines that support CORS.