MDN self-hosted library · e01.org

SecurityPolicyViolationEvent: effectiveDirective property

Reporting API

Open notebook · 1 cells web-api-instance-property upstream source

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