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