Does not register a service worker that controls page and start_url
Stay organized with collections
Save and categorize content based on your preferences.
Registering a service worker
is the first step towards enabling key Progressive Web App (PWA) features:
Works offline
Supports push notifications
Can be installed to the device
Learn more in the Service workers and the Cache Storage API post.
Browser compatibility
All major browsers support service workers. See
Browser compatibility .
How the Lighthouse service worker audit fails
Lighthouse
flags pages that don't register a service worker:
Lighthouse checks if the Chrome Remote Debugging Protocol
returns a service worker version. If it doesn't, the audit fails.
Note: In the Lighthouse report UI the full PWA badge is given when you pass all of the
audits in all of the PWA subcategories (Fast and reliable , Installable , and PWA optimized ).
How to register a service worker
Success: Workbox is the recommended approach for adding
service workers to websites because it automates a lot of
boilerplate, makes it easier to follow best practices, and
prevents subtle bugs that are common when using the low-level
ServiceWorker
API directly.
Registering a service worker involves only a few lines of code,
but the only reason you'd use a service worker
is to make it possible to implement one of the PWA features outlined above.
Actually implementing those features requires more work:
Resources
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-16 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-16 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-16 UTC."],[],[]]