SecurityPolicyViolationEvent: effectiveDirective 属性
注意:此功能在 Web Workers 中可用。
SecurityPolicyViolationEvent 接口的 effectiveDirective 只读属性是一个字符串,表示被违反的 内容安全策略 (CSP) 指令。
此属性取代了其历史别名 SecurityPolicyViolationEvent.violatedDirective。
值
一个字符串,表示被违反的特定 Content-Security-Policy 指令。
示例
js
document.addEventListener("securitypolicyviolation", (e) => {
console.log(e.effectiveDirective);
});
规范
| 规范 |
|---|
| 内容安全策略级别 3 # dom-securitypolicyviolationevent-effectivedirective |
浏览器兼容性
加载中…