Chapter 9. Grabbing Homescreen Real Estate with Installable Web Apps

We have already accomplished so much and learned how to do so many things that were previously unthinkable on the web, but so far we have remained firmly rooted in browser-land. In this chapter, we will finally go beyond the browser and open up a new frontier that has previously been the exclusive domain of the native app.

We will see how we can grab prime real estate on the user’s homescreen and build web apps that can be installed on the user’s device. When users visit these web apps, their browser will automatically prompt to install them to their device’s homescreen. These web apps can launch in full-screen mode (without any of the browser’s UI) so that they are indistinguishable from native apps, can be locked to a certain screen orientation (i.e., horizontal or landscape modes), and more (Figure 9-1).

bpwa 0901
Figure 9-1. The web app install process on Chrome

Installable Web Apps

Considering the wonders promised in the introduction to this chapter, the implementation details are surprisingly simple. In fact, only three steps are required:

  1. Register a service worker.

  2. Create a web app manifest file.

  3. Add a link to the manifest from the web app.

Seeing as we already have a service worker registered in our web app, we are already a third of the way there. Let’s take the final two steps.

First, we will create ...

Get Building Progressive Web Apps now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.