Back to Content

SecurityPolicyViolationEvent: lineNumber property

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

latest644 B
Original Source

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

The lineNumber read-only property of the {{domxref("SecurityPolicyViolationEvent")}} interface is the line number in the document or worker script at which the Content Security Policy (CSP) violation occurred.

Value

A number representing the line number at which the violation occurred.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

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