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

The InstallEvent interface represents an install action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. As a child of ExtendableEvent it ensures that functional events (like FetchEvent) are not dispatched during installation. 


Inherits properties from its ancestor, Event.


Inherits methods from its parent, ExtendableEvent.


This code snippet is from the service worker fetch sample. The code calls ExtendableEvent.waitUntil(any value) in ServiceWorkerGlobalScope.oninstall, delaying treating the ServiceWorkerRegistration.installing worker as installed until the passed promise resolves successfully. The promise resolves when all resources have been fetched and cached, or else when any exception occurs.

The code snippet also shows a best practice for versioning caches used by the service worker. Though there's only one cache in this example, the same approach can be used for multiple caches. It maps a shorthand identifier for a cache to a specific, versioned cache name.

Note: Logging statements are visible via the "Inspect" interface for the relevant SW accessed via chrome://serviceworker-internals.

  prefetch: 'prefetch-cache-v' + CACHE_VERSION

self.addEventListener('install', function(event) {
  var urlsToPrefetch = [

console.log('Handling install event. Resources to pre-fetch:', urlsToPrefetch);

  event.waitUntil(['prefetch']).then(function(cache) {
      cache.addAll( {
        return new Request(urlToPrefetch, {mode: 'no-cors'});
      })).then(function() {
        console.log('All resources have been fetched and cached.');
    }).catch(function(error) {
      console.error('Pre-fetching failed:', error);


Specification Status Comment
Service Workers
The definition of 'FetchEvent' in that specification.
Working Draft Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 40.0 No support No support 24 No support
Feature Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? No support No support No support ? No support 40.0

See also

Document Tags and Contributors

Contributors to this page: kscarfone, jpmedley
Last updated by: kscarfone,