Have a voice in guiding the future of Google's developer brands. Share your thoughts in our survey.

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() {
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.