Back to Content

SecurityPolicyViolationEvent: documentURI property

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

latest672 B
Original Source

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

The documentURI read-only property of the {{domxref("SecurityPolicyViolationEvent")}} interface is a string representing the URI of the document or worker in which the Content Security Policy (CSP) violation occurred.

Value

A string representing the URI of the document or worker in which the violation occurred.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

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