A new PWA feature plugin from Google, Automattic, and XWP lays the groundwork for turning WordPress into a Progressive Web App (PWA). Major WordPress features often start life as feature plugins: the new Gutenberg block-based editor was developed and tested as a feature plugin. The PWA plugin modifies WordPress to make it more compatible with PWA technologies such as Service Workers and Web App Manifests.
What Are Progressive Web Applications?
Service Workers play an important role in Progressive Web Apps. A Service Worker is a script that runs in the background independent of web pages. Service Workers can intercept network requests and respond with cached data, allowing web apps to function when there is no network connection.
The combination of the Cache API and a Service Worker can create seamless page transitions: data can be pre-cached and used to render pages in the browser when the user clicks on a link.
Web App Manifests provide configuration data that browsers and operating systems can use to provide a native-like user experience for web applications. When Progressive Web Applications are installed on a mobile device’s home screen, the Web App Manifest tells the browser which icon to use and how the app’s UI should be displayed.
Bringing Progressive Web Applications To WordPress
The current release of WordPress lacks several features it would need to work well as a Progressive Web App.
Each application can only register one Service Worker, which means plugins and themes can’t handle Service Worker registration themselves. The PWA feature plugin introduces an API that allows plugins and themes to register Service Worker scripts with WordPress, which concatenates them into a single script. The WP_Service_Workers API uses the same interface as the familiar WP_Scripts API.
Service Workers require HTTPS connections; they cannot be registered if the connection is insecure. The PWA feature plugin adds an API endpoint for discovering whether a site supports HTTPS.
Why Progressive Web Applications?
Traditional web applications are slower than native applications, can’t be installed, don’t work offline, and don’t integrate well with push notifications. PWAs solve all of these problems (although there are some limitations on Apple devices).
PWAs are also less expensive and complex to build and maintain than native applications. This is particularly beneficial to smaller businesses and retailers that can’t afford to build separate web, iOS, and Android apps.
The PWA feature plugin was released in July. It is probably not a good idea to install it right away on a production site. Feature plugins are part of the WordPress development process: they change often and aren’t guaranteed to be bug free.
It’s also important to note that installing the plugin on your WordPress site won’t turn it into a PWA. The plugin simply adds features that make it easier to build a PWA on WordPress.
If you want to implement PWA features on your site today, the Super PWA plugin is a better option.