Didn't make the #ChromeDevSummit this year? Catch all the content (and more!) in the Chrome Dev Summit 2019 playlist on our Chrome Developers YouTube Channel.

Service Worker Checklist

This page contains a couple of tips that will ensure your users get the best experience from your web app as well as ensuring there aren't any hidden surprises while developing your site.

Register your service worker the right way

In general, you should wait for the window load event before registering your service worker. This will allow the browser to prioritize assets for the page and will prevent any risk of precaching interfering with the page.

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/service-worker.js');
  });
}
DO: Wait until the `window` load event to register your service worker.

Learn More

This guide is a summary of common gotchas developers hit when starting out, but for more information check out the "Service Worker Registration" guide.