Service Worker Sample: Pre-fetching Resources During Registration

Available in Chrome 40+

This sample demonstrates basic service worker registration, in conjunction with pre-fetching of a list of specific resource URLs during the installation phase.

Visit chrome://inspect/#service-workers and click on the "inspect" link below the registered service worker to view logging statements for the various actions the service-worker.js script is performing. Since most of the action takes place during the service worker's install handler, and that is only executed the very first time you visit this page (unless the service worker script changes), it can be helpful to inspect the logging in a Chrome Incognito window.