How to detect browser crashes

One of my colleagues recently asked if anyone knew a way to monitor browser crashes. I didn’t know and was curious to find out.

Detecting browser crashes is a tricky problem, because all the code running on your site stops abruptly when it crashes, so you can’t detect the crash itself. Even if you could, another problem is sending a report to your error tracking endpoint.

Long story short, there is an experimental Reporting API which enables tracking browser crashes, various policy violations (such as Content-Security-Policy, Document-Policy, Permissions-Poliy), deprecated feature usage, and user-agent interventions.

The Reporting API provides two main ways of tracking reports:

  1. Using ReportingObserver, which captures client-side warnings and allows you to respond to them in real-time; since it’s a client-side API, it doesn’t track browser crashes and other issues such as CSP violations.
  2. Using the Reporting-Endpoints HTTP header, which specifies the endpoints to which the browser will automatically send collected reports; it supports all report types, including browser crashes.

There is a good introduction to the Reporting API on the Chrome for Developers portal.

While the Reporting API provides a unified framework for tracking various types of browser reports, it’s worth remembering that it’s not yet stable, the spec is an editor’s draft, and it’s not fully implemented in all baseline browsers. Nevertheless, it can be an invaluable tool for investigating such a tricky problem as a browser crash.