Chapter 11. Progressive Web App Troubleshooting

 

Whenever I give a talk about Progressive Web Apps (PWAs), there’s normally a Q&A session at the end when the audience asks questions or proposes ideas. Often I get asked useful questions that are worth sharing with a wider audience.

In this chapter, I’ve put together a list of some of the questions I regularly get asked about PWAs and Service Workers and tried to include the most accurate answers I can. Some of these questions may seem obvious, and some not so obvious, but I hope you find them useful.

So here goes, in no particular order: a list of helpful tips, tricks, and gotchas that can help you when you build your next PWA.

11.1. Add to Homescreen

The Add to Homescreen (A2HS) functionality is a great addition to the list of amazing PWA features. Due to some of the built-in tendencies of the browser, this functionality can be tricky to control, but there are a few things you can do that will give you a bit more flexibility.

11.1.1. How do I tell how many users are using the Add to Homescreen (A2H- HS) functionality on my site?

When the A2HS banner is shown, you can tap into the beforeinstallprompt event to determine the choice that the user made when they were presented with the banner. The following listing shows this in action.

11.2. Caching

11.3. Debugging Service Worker–specific issues

11.4. Summary

sitemap