Reporting API
The violatedDirective read-only property of the SecurityPolicyViolationEvent interface is a string representing the Content Security Policy (CSP) directive that was violated.
This is a historical alias of SecurityPolicyViolationEvent.effectiveDirective, and has the same value.
Value
A string representing the Content-Security-Policy directive that was violated.
Examples
document.addEventListener("securitypolicyviolation", (e) => {
console.log(e.violatedDirective);
});
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
