files/en-us/web/api/securitypolicyviolationevent/index.md
{{APIRef("Reporting API")}}{{AvailableInWorkers}}
The SecurityPolicyViolationEvent interface inherits from {{domxref("Event")}}, and represents the event object of a securitypolicyviolation event sent on an {{domxref("Element/securitypolicyviolation_event", "Element")}}, {{domxref("Document/securitypolicyviolation_event", "Document")}}, or {{domxref("WorkerGlobalScope/securitypolicyviolation_event", "worker","","nocode")}} when its Content Security Policy (CSP) is violated.
{{InheritanceDiagram}}
SecurityPolicyViolationEvent object instance.null.null.
Both columnNumber and lineNumber should have non-null values if this property is not null.effectiveDirective.document.addEventListener("securitypolicyviolation", (e) => {
console.log(e.blockedURI);
console.log(e.violatedDirective);
console.log(e.originalPolicy);
});
{{Specifications}}
{{Compat}}