MDN self-hosted library · e01.org

SecurityPolicyViolationEvent: violatedDirective property

Reporting API

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

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