COOPViolationReportBody: effectivePolicy property

The effectivePolicy read-only property of the COOPViolationReportBody dictionary indicates the COOP policy of the opened or opener document that triggered the report. It is present on all reports of type coop.

Note that the term "effective" is used for the property because to indicate that it is a policy that is either enforced or reported.

Value

A string that indicates the policy set in Cross-Origin-Opener-Policy or Cross-Origin-Opener-Policy-Report-Only for the document associated with the report.

This will be one of the allowed directive values for Cross-Origin-Opener-Policy.

Examples

Get the effectivePolicy of a COOP violation report

In this example we create a new ReportingObserver to observe COEP violation reports, then log the value of effectivePolicy 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.effectivePolicy); // A COOP directive such as unsafe-none or same-site
}, options);

Specifications

No specification found

No specification data found for api.COOPViolationReportBody.effectivePolicy.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility