Note: This feature is available in Web Workers.
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.
ReportBody
An instance of ReportBody is returned as the value of Report.body. The interface has no constructor.
ReportBody.toJSON() Deprecated
A serializer which returns a JSON representation of the ReportBody object.
In this example we create a new ReportingObserver to observe intervention reports. The InterventionReportBody interface inherits from ReportBody.
const options = {
types: ["intervention"],
buffered: true,
};
const observer = new ReportingObserver(([firstReport], observer) => {
console.log(firstReport.type); // intervention
}, options);
| Specification |
|---|
| Reporting API> # reportbody> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
ReportBody |
69 | 79 | 65 | 56 | 16.4 | 69 | No | 48 | 16.4 | 10.0 | 69 | 16.4 |
toJSON |
69 | 79 | 77 | 56 | 16.4 | 69 | No | 48 | 16.4 | 10.0 | 69 | 16.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ReportBody