A recap of what are PWAs and why is there a need for them.
A showcase of the main characteristics of a PWA in a Proof of Concept built with LitHTML.
demo link: https://razvan-rosu.github.io/demo-polymer3-pwa/
github repository: https://github.com/razvan-rosu/demo-polymer3-pwa
_________________________________________
Note: This is an improved version of my previous presentation (https://www.slideshare.net/RazvanRosu2/progressive-web-apps-with-lithtml), being themed for a local JavaScript Meetup in Bucharest, Romania.
5. User onboarding study case:
“Every step in an onboarding flow
costs 20% of users (on average)”
https://medium.com/gabor/every-step-costs-you-20-of-users-b613a804c329
6. Quick comparison: App vs PWA
(Native) User flow:
- find the app
- install the app
- open
- use
- share
(PWA) User flow:
- immediately use the web app
- prompt to install upon return
7. Quick comparison: App vs PWA
Native:
- native apps with push
notifications retain 30%
more users than
native apps without
- a user is more likely to
reopen a mobile application
than a website
PWA:
- have push notifications
- can be installed
9. 1. Loads quickly (app shell)
The key feature is to progressively load the app.
Initially, we load an empty app shell with a loader.
Afterwards, we lazy load the content.
11. 2. Cross device (responsive UI)
Progressive Web Apps run on any device
within a browser engine.
The user interface can scale accordingly using
Responsive Web Design techniques.
13. 3. Offline (service workers)
Progressive Web Apps can run offline
with the help of Service Workers (SW).
14. 3. Offline (service workers)
Service Worker (SW):
- it is a script
- it runs in the background, separate from the webpage
- it can synchronize offline content
- it has a lifecycle
Service Workers require a server with HTTPS
15.
16. 3. Offline (service workers)
Service Workers generators:
- sw-precache
https://github.com/GoogleChromeLabs/sw-precache
- workbox
https://developers.google.com/web/tools/workbox/
Or, we can build a sw from scratch:
https://developer.mozilla.org/en-US/docs/Web/API/Service
_Worker_API
18. 4. Installable (app manifest)
Progressive Web Apps can be installed with
the help of a manifest.
https://developers.google.com/web/fundamentals/web-app-manifest/
19. 4. Installable (app manifest)
<link rel="manifest" href="./manifest.json">
{
"name": "Proof of Concept: Polymer 3 Progressive Web App",
"short_name": "PoC: PWA",
"description": "a demo of a progressive web app",
"icons": [
{
"src": "assets/android-launchericon-144-144.png",
"sizes": "144x144",
"type": "image/png"
},
…
],
"start_url": "/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#FE7A22",
"theme_color": "#FE7A22"
}
name: defines how the application will be listed
short_name: in Chrome for Android, it is the name to accompany the icon
on the home screen
description: general description of the app
icons: array of images serving as a set of icons and splash screens
start_url: starting URL of the application
display: defines the default display mode (fullscreen, standalone,
minimal-ui, browser)
orientation: portrait or landscape
theme_color: on Android, status bar color
background_color: background color of the app; in Chrome, also
background color of the splashscreen
20. 4. Installable (app manifest)
There is an alternative to the manual declarations: PWACompat.
PWACompat is a library that will generate the meta tags.
<link rel="manifest" href="manifest.webmanifest">
<!-- include PWACompat _after_ your manifest →
<script async src="https://cdn.jsdelivr.net/npm/pwacompat@2.0.6/pwacompat.min.js"
integrity="sha384-GOaSLecPIMCJksN83HLuYf9FToOiQ2Df0+0ntv7ey8zjUHESXhthwvq9hXAZTifA"
crossorigin="anonymous"></script>
! Both manifest.json and manifest.webmanifest seem to work just
fine with PWAcompat.
https://github.com/GoogleChromeLabs/pwacompat
https://www.npmjs.com/package/pwacompat
23. 5. Engaging (push notifications)
Push notifications were initially available only in native apps.
A user would still receive web push notifications
even if the PWA is not open in a browser tab,
and even if the browser is closed.
24. 5. Engaging (push notifications)
The PWA will ask the user for permissions
to display notifications.
The PWA also needs to be subscribed to a Push server,
in order to receive the notifications.
Each browser vendor has his own Push server.
30. Important mentions:
In March 2018, Google announced .app TLD for PWAs https://get.app/
In March 2018, iOS started supporting PWAs. (Probably since then) the App Store
allows PWAs
https://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7
In June 2018, Microsoft started allowing PWAs in the Microsoft Store
https://docs.microsoft.com/en-us/microsoft-edge/progressive-web-apps/microsoft-stor
e
In January 2019, Google started allowing PWAs in the Google Play Store
https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc