There are many technologies commonly used to create progressive web apps. A web application is considered a PWA if it satisfies the installation criteria, thus can work offline and can be added to the device's home screen. To meet this definition, all PWAs require at minimum a manifest and a service worker. Other technologies may be used to store data, communicate with servers or execute code.
Manifest The web app manifest is a
World Wide Web Consortium (W3C) specification defining a
JSON-based manifest (usually labelled manifest.json)
Service workers A service worker is a
web worker that implements a programmable network proxy that can respond to web/HTTP requests from the main document. It is able to check the availability of a remote server, cache content when that server is available, and serve that content to the document later. In PWAs, service workers act as an intermediary between the network and the device and can use caching mechanisms to serve content reliably. This enables features such as offline operation by serving previously cached resources when connectivity is unavailable. The service worker is responsible for pre-loading content of the app and serving it to users. It also supports offline experience, handles network requests, and minimizes the data traffic. Service workers, like any other web workers, work separately from the main document context. Service workers can handle
push notifications and synchronize data in the background, cache or retrieve resource requests, intercept network requests and receive centralized updates independently of the document that registered them, even when that document is not loaded. Service workers go through a three-step lifecycle of Registration, Installation and Activation. Registration involves telling the browser the location of the service worker in preparation for installation. Installation occurs when there is no service worker installed in the browser for the web app, or if there is an update to the service worker. Activation occurs when all of the PWA's pages are closed, so that there is no conflict between the previous version and the updated one. The lifecycle also helps maintain consistency when switching among versions of a service worker since only a single service worker can be active for a domain. Thus, libraries written in languages such as
C can be added to web apps. Announced in 2015 and first released in March 2017, WebAssembly became a W3C recommendation on December 5, 2019 and it received the
Programming Languages Software Award from
ACM SIGPLAN in 2021.
Data storage Progressive web app execution contexts get unloaded whenever possible, so progressive web apps need to store the majority of their long-term internal state (user data, dynamically loaded application resources) in one of the following manners: ;Web storage:
Web storage is a WHATWG standard API that enables key–value storage in modern browsers. The API consists of two objects, sessionStorage (that enables session-only storage that gets wiped upon browser session end) and localStorage (that enables storage that persists across sessions). ;Indexed Database API:
Indexed Database API is a W3C standard database API available in all major browsers. The API is supported by modern browsers and enables storage of
JSON objects and any structures representable as a string. The Indexed Database API can be used with a
wrapper library providing additional constructs around it. == Comparison with native apps ==