COOPViolationReportBody: type property

The type read-only property of the COOPViolationReportBody dictionary returns a value that indicates whether the violation is reported by the opened or opener document, and whether it was triggered by a navigation or an attempt to access an opened document that is blocked by the policy.

The fields present in the report depend on the type.

Value

A string that can have one of the following values:

"access-to-opener"

The violation was caused Xxxxx

For more information see access-to-opener report.

This report is from the opened document (that was navigated to) and indicates a policy violation that caused by a COOP policy mismatch.

For more information see navigation-to-response report.

This report is from the opener document (that was navigated from) and indicates a policy violation that caused by a COOP policy mismatch.

For more information see navigation-from-response report.

Description

The type indicates whether the report is due to a navigation, and is from the perspective of the opener or opened document, or is caused by an attempt to access the opener. It affects the properties that will be present in the reports.

The report types are described in the following sections.

A report from the perspective of the document that was opened during a navigation.

It indicates that the document that was navigated to was opened in a new browsing context group (BCG) due to an enforced COOP, or should have been for a report-only COOP.

This is caused when the COOP policy of the opened document is incompatible with its opener. For navigations this means that the opened document has a different COOP policy from its opener, or the same policy but they are not same-site (unless both documents have a COOP policy of unsafe-none).

Report of type navigation-to-response have the following properties

A report from the perspective of the opener document in a navigation

It indicates that the new document was, or should have been, opened in a new browsing context group (BCG) due to a mismatch in policies.

The only difference when compared to a report for navigation-to-response is that other properties are associated with the opener. For example, the effectivePolicy is that of the opener rather than the opened document.

Report of type navigation-from-response have the following properties

  • disposition: Whether the policy is enforced or reported.
  • effectivePolicy: The policy of the opener document.
  • nextResponseURL: ???? If coopOrigin and nextResponseOrigin are same origin or isCOOPResponseNavigationSource is true, this is the sanitization of nextResponseURL, null otherwise.
  • type: navigation-from-response

access-to-opener report

Examples

Get the type of a COOP violation report

In this example we create a new ReportingObserver to observe COEP violation reports, then log the value of type 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.type); // access-to-opener or one of the other types
}, options);

Specifications

No specification found

No specification data found for api.COOPViolationReportBody.type.
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