COEPViolationReportBody: blockedURL property

The blockedURL read-only property of the COEPViolationReportBody interface returns the URL of the resource that was blocked from loading by an enforced COEP violation (Cross-Origin-Embedder-Policy), or would be blocked if a report-only policy was set (Cross-Origin-Embedder-Policy-Report-Only).

Value

An string containing a URL value.

Examples

Get the URL of the resource that triggered the report

In this example we create a new ReportingObserver to observe COEP violation reports, then log the value of blockedURL to the console.

js
const options = {
  types: ["coep"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  const firstReport = reports[0];
  console.log(firstReport.type); // coep
  console.log(firstReport.body.blockedURL); // URL of the violating resource
}, options);

Specifications

Specification
HTML
# embedder-policy-checks
HTML
# coep

Browser compatibility