A script returns 200 but SRI blocks the page from working
Diagnose a Subresource Integrity mismatch after deployment, compare the trusted asset with its published hash, and restore the script without removing protection.
By Crawlito · 6 min read
In short
- A successful download can still be rejected by the browser when its integrity hash does not match.
- Compute release hashes from trusted final assets, after intentional transformations.
- Verify the page's actual behavior after deploying matching markup and immutable assets.
On this page
- Confirm that integrity is the blocking condition
- Match the markup to one specific release artifact
- Compute a diagnostic hash from the trusted final file
- Check cross-origin delivery as a separate requirement
- Publish matching HTML and assets in a safe order
- Verify execution, content, and the reader's action
- Keep the release contract easy to audit
- Frequently asked questions
If a script returns 200 but the page remains incomplete, look for a Subresource Integrity error in the browser console. The browser can download a resource and refuse to execute it because its bytes do not match the integrity value in the HTML. Compare the trusted release artifact with the delivered asset, then publish a consistent pair without removing the protection.
This problem often appears after an asset replacement or a deployment that updates HTML and scripts separately. A status-only check misses it because the network request itself can succeed.
Confirm that integrity is the blocking condition
Open the failing page with the browser's Network and Console panels visible. Record the resource URL, the integrity-related message, and the element that requested the resource.
Do not treat every script failure as an SRI mismatch. A wrong MIME type, CORS denial, syntax error, or missing file can produce a different message and require a different repair.
MDN's SRI documentation explains that the browser compares fetched resources with declared hashes before using them.
Inspect the actual delivered script or stylesheet element. A source template may contain the right value while cached HTML still references an older value.
The raw versus rendered HTML guide helps distinguish what was delivered from what the browser ultimately executed. Save both the element markup and the failed resource's response details before changing the release.
Identify the affected user task too. A blocked decorative script has a different practical impact from a blocked module that supplies the article or runs the checker form.
Match the markup to one specific release artifact
Find the trusted artifact used by the deployment: the final script or stylesheet produced by the approved build. Record its versioned filename or release identifier.
Compare that artifact with the public resource at the URL in the failing element. Avoid comparing against an unminified source file when the page loads a minified bundle.
Any intentional transformation after hash generation can change the bytes. Examples include minification, injected banners, or a CDN feature that rewrites the response. Establish the actual publishing sequence.
A content-versioned filename makes the relationship easier to understand. Replacing the bytes behind one stable filename while old HTML still names its old hash creates a consistency problem.
Do not assume the newly downloaded bytes are trustworthy simply because they came from the expected hostname. An integrity failure is a reason to investigate the difference, not automatically to approve whatever response appeared.
Keep the trusted build output separate from the downloaded comparison file throughout the diagnosis.
Compute a diagnostic hash from the trusted final file
For a release using SHA-384, a local diagnostic command is:
openssl dgst -sha384 -binary trusted-release.js | openssl base64 -AThe resulting Base64 value follows the sha384- prefix in an integrity attribute. Use the algorithm actually declared by your release rather than changing algorithms during the investigation.
Compare the result with the value in the public HTML. A mismatch between the approved artifact and its declared hash indicates a build or publication inconsistency.
If the approved artifact matches the declared hash but the public resource differs, inspect the asset delivery path. Confirm that the URL is not returning a login page, error document, or transformed version.
This calculation is a local comparison, not a replacement for the browser's verification. Keep the original console message and repeat the browser test after repair.
For third-party resources, use a version and integrity value supplied through a trustworthy release process. Do not generate a new production hash from an unexplained changed third-party response merely to suppress the error.
Check cross-origin delivery as a separate requirement
SRI on a cross-origin resource also depends on the browser's cross-origin request rules. MDN documents the need for appropriate CORS support and the corresponding element configuration.
An element may have the correct hash and still fail because the resource server does not permit the required cross-origin access. Read the console message carefully rather than assuming one repaired hash resolves every failure.
Inspect the resource response from the same public path the page uses. A successful direct navigation to the script does not reproduce its embedded loading context.
The CORS and crawler access guide explains why browser enforcement and a server-side fetch are different observations.
Do not broaden a private resource's cross-origin policy to make a public page dependency work. Confirm that the asset is intentionally public and that its supported delivery configuration matches that purpose.
Keep integrity and CORS findings separate in the handoff so the asset owner knows which requirement remains unmet.
Publish matching HTML and assets in a safe order
Repair the process that generated the mismatch. Generate integrity values from the final trusted asset bytes and ensure the associated markup references that exact artifact.
Prefer keeping old versioned assets available while previously published HTML can still reference them. Removing an old asset immediately can turn a consistency issue into a missing-file incident for returning visitors.
If the CDN intentionally transforms assets, review whether that transformation belongs in the supported SRI workflow. Do not leave an undocumented post-hash rewrite enabled.
Deploy the asset and its referencing HTML through the normal release process. If stale markup remains in a cache, recover the affected representation using the platform's scoped procedure.
The stale CDN content guide helps investigate a public page that still carries the previous release's references.
Avoid removing integrity attributes as the permanent repair. That would change the security contract while leaving the publishing process unable to keep its artifacts consistent.
Verify execution, content, and the reader's action
Reload the public page in a fresh session and confirm that the integrity error is gone. Then test the behavior the resource provides.
For an article renderer, confirm that the actual answer and internal links appear. For a form script, complete an approved test through its expected success state rather than stopping after the button responds.
Check a returning session as well. Old HTML or cached assets may exercise a different combination from a clean load.
Test a second page that uses the same resource. The shared dependency may affect an entire template even when the original report mentioned only one URL.
Inspect the final public script element and resource response again. Record the release identity and the successful browser observation.
Do not report an HTTP 200 alone as completion. The original failure happened after download, so the acceptance evidence must include successful use of the resource.
Keep the release contract easy to audit
Store the relationship between the asset filename, final bytes, and integrity value in the build output or release manifest. That makes the next investigation a comparison rather than a manual reconstruction.
Include an embedded-resource browser check in the relevant release workflow. A test that downloads files without loading the page cannot detect every browser-enforced failure.
When handing the fix to an agency or client, describe the specific cause: stale HTML, overwritten asset, incorrect hash generation, transformation, or a separate cross-origin problem. Avoid labeling all of them “JavaScript SEO.”
The verified result is that the tested browser can use the intended resource and the page works. It does not establish how every AI fetcher executes JavaScript or whether a search engine will cite the page.
Keep essential public answers readable through the site's supported rendering design so one optional enhancement does not determine whether a visitor can understand the page at all.
Frequently asked questions
Why does the Network panel show 200 for a blocked script?
The download can succeed before the browser rejects the resource's integrity. Inspect the console and the element's integrity value as well as the status.
Can I just replace the hash with one from the downloaded file?
Only after establishing that those bytes are the approved release. Do not automatically trust an unexplained changed response.
Does SRI affect a crawler that never runs JavaScript?
This test establishes browser resource behavior. A fetcher that reads only HTML follows a different path, so inspect the delivered article separately.
After repairing the resource, use the free Crawlito check on the public page to review its delivered content and other readiness signals.
Filed under Rendering and content. Topics: javascript, cdn, troubleshooting