Progressive Web Apps (PWAs) are an attempt at marrying the best features offered by modern browsers to the best of a native application. PWAs are a lot like native applications but are accessible and deployed from web servers via URLs, so a user won’t need to visit an app store to download your application. If you’re on a desktop, using Chrome, and have the appropriate flags turned on, you will be prompted to install the app when you visit the site. What makes it different from a web application is that it can be “installed” on your system. You can still access it offline like any other native application by leveraging data cached during your last interactions with the app. PWAs need to meet the below set of essential requirements to be qualified as one. They need to be:
- Progressive: Regardless of browser choice, must work for each user as the core tenet they are built on is progressive enhancement.
- Connectivity independent: Enhanced with service workers to on low-quality networks or work offline.
- Responsive: Fit any desktop, form factor, tablet, and mobile.
- Up-to-date: Thanks to the service worker update process, it's always up-to-date.
- App-like: To provide app-style interactions and navigation, use the app-shell model.
- Safe: To ensure content has not been tampered with and prevent snooping, served via HTTPS.
- Re-engageable: Through features like push notifications, makes re-engagement easy.
- Installable: Allow users to “keep” apps they want to on their home screen, without the hassle of an app store.
- Discoverable: Thanks to service worker registration scope and W3C manifests allowing search engines to find them, are identifiable as “applications.”
- Linkable: No need for complex installation, rather share via URL.
- Smooth user experience: The user’s experience with page transitions and scrolls have to be smooth as butter.
- Fast Loading: The app must be close to instantaneous or lightning fast when loading.
- Splash Screen: To make a PWA feel more like a native app, should add a splash screen during the start of the app.
But what does it truly mean for a web application to be progressive?
Progressive here isn’t referring to embracing new frameworks or technologies. It points to a set of best practices to help you build a web application that functions similarly to a native mobile application. The ideal is to have an experience so seamless and uniform that the user is unable to tell the difference between a native mobile app and a Progressive Web App.
Progressive web applications as it is, deliver user experiences through progressive enhancement. Meaning, a PWA should perform the same functions on an iPhone X as it would on an older generation iPhone. Sure, certain features might not be available, but the app must continue to work and perform like it should.
Take the Instagram or Twitter application on your cell phone for instance. You can still open the app even when there is no network, check past posts and messages and even reply to someone. When your cell gets network connection again, the messages will automatically be sent in the background. In web apps, this is what PWA promises to bring. It enables web apps to load even across a lousy network, sync in the background and seamlessly do things while giving your users a native-like experience. When we download and install a native application, some data and critical resources like UI components and are stored in the device, and so without an internet connection, native apps can open. Even in a PWA, this is how it functions. The PWA stores CSS files, HTML files, and images in the browser cache and the developers are able to control the network call entirely. All of this is possible thanks to Service Workers. We'll explore that in a while.
Most have come to see that these features make a PWA the best of the web and the best of a native app. It begins as a normal web page in a browser. And, as a user explores this webpage, they get a prompt about whether they would like to “Add to Home Screen.” Once the user gives his or her thumbs up to this prompt, the PWA gets added to their home screen. And when they open this app installed on their home screen, it can give the appearance of a native app as it can hide the browser UI controls.
Think of it as a glorified bookmark which has found the sweet spot between mobile apps and the web. PWA has been able to bridge the gap in the web. Web pages have always yearned for a place in the home screen and the notification tray just like an app. It has forever been thirsty for reliable performance comparable to the one provided by native apps. Studies have shown that more than 40% of global users bounce from web pages that take more than three seconds to load. To tackle this “Web Obesity Epidemic” faced by your users, PWA is your solution. It is all about making it easier for users to reach what they want by removing friction.
So what are the crucial elements of a PWA?
The service worker
The entire credit for the seamless experience of a PWA goes to the Service Worker. It serves as the backbone of each PWA. The service workers enable intelligent and reliable caching, push notifications, background content updating, and the, of course, offline functionality to previously visited sites. Meaning, the app, and site, even on flaky networks, will be reliably fast after the first visit to a website. Background sync and push notification are optional but are recommended to provide a more native-like experience. Service workers can intercept the network requests and can also modify the responses. All these actions are performed by the service worker on the client side. Therefore, PWA needs a secure protocol HTTPS.
Now consider AMPs or Accelerated Mobile Pages. For the first load, they provide reliably fast web components. These components are much less data hungry and faster to load. Websites that use the combo of Service Worker and AMP will provide reliable speed, comparable to that of a native application. The site sets up the service worker and assets are cached intelligently once the page is loaded. Keeping the PWA up to date by itself means users won't have to see the frequent updates from the App Store.
Service workers can modify the responses and has the ability to intercept the network requests. All the actions on the client side are performed by service workers. And so PWA needs a secure protocol HTTPS.
The manifest file
The manifest file happens to be a config JSON file that holds information pertaining to your application, like the short name of the application, the icon that has to be displayed on the home screen when installed, background color, or theme. Automatically, the Chrome browser will trigger the web app install banner if the manifest file is present, and if the user agrees, this adds the icon to the home screen, and the PWA is installed.
To explore the various challenges and benefits of a Progressive Web App, click here.