ReportBody

The ReportBody interface of the Reporting API represents the body of a report. Individual report types inherit from this interface, adding specific attributes relevant to the particular report.

Reports that inherit from ReportBody

An instance of ReportBody is returned as the value of Report.body. The interface has no constructor.

Methods

ReportBody.toJSON()

A serializer which returns a JSON representation of the ReportBody object.

Examples

In this example we create a new ReportingObserver to observe intervention reports. The InterventionReportBody interface inherits from ReportBody.

let options = {
  types: ['intervention'],
  buffered: true
}

let observer = new ReportingObserver(function(reports, observer) {
  let firstReport = reports[0];
  console.log(firstReport.type); // intervention
}, options);

Specifications

No specification found

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

No compatibility data found for api.ReportBody.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.