ReportingObserver: takeRecords() method
Baseline
2026
Newly available
Since March 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Web Workers.
The takeRecords() method of the ReportingObserver interface returns the current list of reports contained in the observer's report queue, and empties the queue.
Syntax
js
takeRecords()
Parameters
None.
Return value
An array of report objects, such as COEPViolationReport and IntegrityViolationReport.
The object dictionaries are listed in Reporting API.
Examples
>Basic usage
js
const options = {
types: ["deprecation"],
buffered: true,
};
const observer = new ReportingObserver((reports, observer) => {
reportBtn.onclick = () => displayReports(reports);
}, options);
observer.observe();
// …
const records = observer.takeRecords();
console.log(records);
Specifications
| Specification |
|---|
| Reporting API> # dom-reportingobserver-takerecords> |