CentralCSP
Reporting APIConcepts

ReportingObserver

The ReportingObserver JavaScript API lets a page read its own reports in band, including buffered reports from before it ran.

Last update:

ReportingObserver is the in-page side of the Reporting API. Instead of sending reports to a server, it hands them to JavaScript on the same page, so you can log deprecations, interventions, and policy violations from the client. It also exposes a buffer of reports generated before the observer started.

Baseline 2026

ReportingObserver has shipped in Chromium since Chrome 69 and in Safari since 16.4, and Firefox 149 (March 2026) completed cross-browser support. Which report types each engine surfaces still differs; see Browser support below.

What it observes

A ReportingObserver sees the report types the browser surfaces to the page. In Chromium these are csp-violation, deprecation, intervention, coep, permissions-policy-violation, potential-permissions-policy-violation, document-policy-violation, integrity-violation, connection-allowlist, and COOP access reports (coop-access-violation). You can observe all of them or filter to specific types. Chromium buffers the 100 most recent reports of each type for buffered: true.

It does not surface every report type. crash reports never reach a ReportingObserver, since the page is gone before a callback could run, so a crash is delivered to a server endpoint only. csp-hash reports, network-error reports, and COOP navigation reports are likewise server-endpoint only. For crash reporting, and for any aggregation across users, use a server endpoint instead.

Basic usage

You construct an observer with a callback and options, then call observe().

const observer = new ReportingObserver((reports, observer) => {
  for (const report of reports) {
    console.log(report.type, report.body);
  }
}, { types: ["deprecation"], buffered: true });

observer.observe();

The constructor takes (callback, options). In options, types is an array of report types to watch (omit it to observe all observable types), and buffered: true delivers reports that were generated before observe() was called, from the browser's report buffer, which is how you catch deprecations that fired during early page load. The observer also has disconnect() to stop, and takeRecords() to pull and clear any queued reports synchronously. ReportingObserver is available in Web Workers as well as documents in Chrome 84+ and Firefox 149+, but not in Safari.

When to use it vs a server endpoint

Use ReportingObserver when you want reports in your own client code: surfacing deprecations to developers in a staging build, or feeding violations into a front-end error pipeline you already run. Use a server endpoint (the rest of this reference) when you need crash reports, or when you want to aggregate reports across all your users rather than per-session. CentralCSP collects the out-of-band, server-side stream, which is the one you build monitoring and alerting on.

Browser support

ReportingObserver is available in Chrome 69+, Safari 16.4+, and Firefox 149+. Support is not uniform per report type:

Report typeChromiumFirefoxSafari
csp-violation74+149+18.4+
deprecation69+149+ (not in workers)No
integrity-violation138+149+No
coepYesNo16.4+
intervention, permissions-policy-violation, document-policy-violation, connection-allowlistYesNoNo

Crash reports are never among them; they are delivered to a server endpoint only. Confirm the specific types you depend on before relying on the API in production.

See also

Sources

On this page