What is a “Script Error” and why isn’t there more information?
Most modern browsers report errors from third party domains as an intentionally vague “Script error.” message. This is done for security reasons as the browser can’t be sure that it’s safe to provide potentially sensitive information to a different domain.
If you own the other domain the scripts are on, then it’s possible for you to get more information by following these steps:
- First, add
crossorigin="anonymous"
to the<script>
element that’s loading the JavaScript on a third party domain. - Then, in the server that serves the JavaScript file, make sure the cross origin header is present in the HTTP response:
Access-Control-Allow-Origin
When done correctly, this signals to the browser that your website and the other domain are connected and you’ll be able to see more information for these errors.
If you do not own the other domain, then unfortunately, and the people who host that domain do not send this header, then, unfortunately, there is no way for you to get extra information for this error.