首页 > 解决方案 > 是否可以使用 javascript 记录客户端子资源完整性错误?

问题描述

我正在寻找一种方法来拦截在任何完整性哈希值无效时生成的子资源完整性错误消息。有没有办法使用页面上的 JavaScript 拦截这些事件,或者检测节点是否具有无效integrity属性?

例如这些错误消息:

None of the “sha384” hashes in the integrity attribute match the content of the sub-resource.

Failed to find a valid digest in the 'integrity' attribute for resource 'http://path/to/file' with computed SHA-256 integrity '[hash]'. The resource has been blocked.

标签: javascriptsubresource-integrity

解决方案


推荐阅读