ServiceWorkerContainer.onerror

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The onerror property of the ServiceWorkerContainer interface is an event handler fired whenever an error event occurs in the associated service workers.

Syntax

serviceWorkerContainer.onerror = function(errorevent) { ... }

Example

navigator.serviceWorker.onerror = function(errorevent) {
  console.log(`received error message: ${errorevent.message}`);
}

Browser compatibility

BCD tables only load in the browser