-
@windowsdev I think the biggest feature of PWAs is ServiceWorker. In many ways, it’s the “special sauce” that makes PWAs so powerful.
-
@windowsdev ServiceWorker is a networking proxy you control via JavaScript. That may sound kinda boring, but the concept is incredibly powerful.
-
@windowsdev It’s powerful because this capability enables you to intercept & respond to resource requests without ever going to the network.
-
@windowsdev Using ServiceWorker in concert with the Cache API, you can keep copies of requested resources in the browser cache and respond with those rather than requesting them from the network every time.
-
@windowsdev And ServiceWorkers—yes, you can have more than one—have a lifecycle that includes an installation phase. That’s a time when you can pre-cache common, long-lived resources like your site’s logo, CSS, and core JavaScript functionality.
-
@windowsdev Once installed, you can start to do even cooler stuff like check to see if the browser supports WebP and respond to all requests for JPG versions of images with a WebP instead without having to modify a page’s HTML.
-
@windowsdev Many browsers (and the Microsoft Store) now also allow you to install PWAs. In most browsers, the experience is pretty similar to having a dedicated browser window, which is convenient but not terribly interesting.
-
@windowsdev When installed via the Microsoft Store, however, you get access to OS-level APIs too. That means Live Tiles, integration with the Share Charm, Dark Mode, and more. Anything a native UWP app can do, a Windows PWA can do. That’s powerful.
-
@windowsdev I’m honestly hopeful that more operating systems begin offering similar paths to true app citizenship for PWAs. And, at the same time, I’m also hoping more native APIs make their way onto the web as cross-platform standards.