Back to Content

SecurityPolicyViolationEvent: referrer property

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

latest690 B
Original Source

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

The referrer read-only property of the {{domxref("SecurityPolicyViolationEvent")}} interface is a string representing the referrer for the resources whose Content Security Policy (CSP) was violated. This will be a URL or null.

Value

A string representing the URL for the referrer of the resources whose policy was violated, or null.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

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