我正在寻找一种方法来拦截在任何完整性哈希值无效时生成的子资源完整性错误消息。有没有办法使用页面上的 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.