Back to Content

SecurityPolicyViolationEvent: effectiveDirective property

files/en-us/web/api/securitypolicyviolationevent/effectivedirective/index.md

latest841 B
Original Source

{{APIRef("Reporting API")}}{{AvailableInWorkers}}

The effectiveDirective read-only property of the {{domxref("SecurityPolicyViolationEvent")}} interface is a string representing the Content Security Policy (CSP) directive that was violated.

This supersedes {{domxref("SecurityPolicyViolationEvent.violatedDirective")}}, its historical alias.

Value

A string representing the particular Content-Security-Policy directive that was violated.

Examples

js
document.addEventListener("securitypolicyviolation", (e) => {
  console.log(e.effectiveDirective);
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("CSPViolationReportBody.effectiveDirective")}}