Create Experiences Not Products!
Create Experiences Not Products!

Requirements Of A PWA

A progressive web app requires a https environment, web manifest and service worker at the minimal.

What is the Manifest?

The PWA manifest is a W3C specification defining a JSON-based manifest. ( it is usually labelled manifest.json ) This manifest allows developers to put metadata associated with the progressive web application. Commonly included metadata are:

  • The name of the PWA
  • Links to the PWA icons or image objects
  • The preferred URL to launch or open the PWA
  • The PWA configuration data
  • Default orientation of the PWA
  • The option to set the display mode, e.g. native mode or browser mode

This metadata is an important requirement for a PWA to be added to a home screen and listed alongside native apps.

What is the Service Worker?

A service worker is the name given to a JavaScript file that operates as a type of web worker. These scripts work separately from the main browser thread to handle push notifications, synchronize data in the background, cache content or retrieve resource requests and receive centralized updates. This script also gives the ability to intercept network requests.

Service workers are used so as to give progressive web applications the ability to provide the high performance and rich experience that is common to native mobile apps. As a web based technology, it comes with the added bonus of requiring low storage space, ability to receive real-time updates and enjoying search engine visibility.

Service workers go through a three-step phase know as the life cycle. It consists of Registration, Installation and Activation.

  • Registration involves telling the browser the location of the service worker script required for installation.
  • Installation occurs when there is no existing service worker installed in the browser for the PWA or if there is an update to the service worker.
  • Activation occurs when all of the PWAs pages are closed. This is important so as to prevent conflict between the previous version and the updated one. This life cycle concept helps maintain consistency.

Service workers usually function as a scriptable network proxy in the web browser so as to manage the web/HTTP requests programmatically. The service workers lie between the network and device to supply the content. This allows the capability of deploying efficient cache mechanisms and serves to provide an offline environment so that users do not get a browser error page when the device is not connected to the internet.

Apps by Mor