A script error occurs when an error on a third-party plugin, file, or add-on triggers an error on your domain. Modern browsers block local scripts from accessing information from external domains, so while Noibu detects and reports script errors, the NoibuJS script cannot retrieve specific information about the errors. The NoibuJS script wraps your frontend code to extract as much data as possible when errors occur. Script errors pass by this wrapping, but we do our best to separate distinct script errors to offer the most error coverage possible. You can identify a script error in the Noibu platform by its error signature, which always begins with script error.
The root cause of a script error is cross-origin request blocking. To expand the range of error data Noibu collects, you can change the way you fetch certain scripts from their respective servers to avoid cross origin checking. Consider the methods listed below:
Method 1: Add the crossorigin Attribute to the Script Tag in your HTML
Imagine you have a third-party script enabled in your HTML code, written as follows:
To instruct the server to fetch the script URL anonymously, add
crossorigin="anonymous" to the script tag. This enables Noibu to access more error data without impacting the script's functionality.
The adjusted script looks like this:
<script src="http://not-your-domain.com/app.js" crossorigin="anonymous"></script>
Method 2: Add Cross Origin Headers
The implementation steps for adding cross-origin headers vary depending on your backend architecture, and the solution is only possible if you have access to the server.
The solution is to configure your backend so that when the script is requested from the client side, the following header is sent back:
Note: Most public URLs, like Google Tag Manager, already have this setting enabled. Contact us at email@example.com to investigate whether or not a certain server has cross-origin headers enabled.
Learn more about Error Signatures.