Cross-Origin Resource Sharing (CORS)
You want richer error data? - Enable CORS!
Coview platform has built-in functionality for monitoring and tracking down errors originating in your customer's browser. Usually, browsers happily report any errors - except when the offending code is served from a CDN or a different domain. In that case, all that you get is a meaningless
Script error on line 0 message instead of a stack trace and a description.
To unlock error reporting for cross-origin scripts, you will need to enable CORS support. This will let you bypass the same-origin policy in a secure way and allow Coview to capture error data coming from other third-party scripts as well.
Enabling CORS on your website is straightforward and involves two steps described below.
1. Send the CORS header for your script files
Attach the following HTTP header to the response containing your script files:
2. Modify your script tags
Script tags have an attribute called
crossorigin which allows to pass error data to a
window.onerror callback. Define it on applicable script tags with a value set to
<script src="https://example.com/example-framework.js" crossorigin="anonymous" ></script>
Updated about 3 years ago