This article needs a technical review. How you can help.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

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.
Editor's Draft Initial definition.

Browser compatibility

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

See also

Document Tags and Contributors

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