β everywhere
β install every time...
β no install
β open
β powerful
β requires connection
β not the norm on mobile
React
Angular
Vue
?.js
icons from iconfinder
...is a worker registered against an origin and a path.
It takes the form of a JavaScript file that can control the web page/site it is associated with [...].
Service Worker
Client
Server
Register the SW*
SW is installing
π
β
β
SW is active
* requires HTTPS
Modify the SW
Browser detects the SW difference
New SW is installing π
New SW is waiting
β³ Until the old SW controls no pages
New SW is active
β
β
π€ What about compatibility?
[ π Chrome DevTools ]
β
FORK
β
cd dev-v-dev/__start-files
β
npm install
β
npm run run dev
β
locahost:8080
π index.html
π style.css
π ...
Server
π index.html
π style.css
π ...
example.com
cache storage
IndexedDB
<link rel="manifest" href="manifest.json" />
{
"name": "Dev v Dev",
"short_name": "Dev v Dev",
"theme_color": "#hex",
"background_color": "#hex",
"display": "standalone",
"orientation": "portrait",
"scope": ".",
"start_url": ".",
"gcm_sender_id": "103953800507",
"icons": [{
"src": "image.jpg",
"sizes": "72x72",
"type": "image/png"
},
{
/* ... */
}
]
}
IOS
<meta name="apple-mobile-web-app-capable" content="yes">
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent">
<link rel="apple-touch-icon" sizes="72x72" href="icon.png">
<!-- include multiple so that the browser selects the best one -->
<link rel="apple-touch-startup-image" href="launch.png">
<link
rel="apple-touch-startup-image"
href="launch-portrait.png"
media="(orientation: portrait)">
<!-- include multiple so that the browser selects the best one -->
Server
service-worker
Cache
Push notifications & Installation banner
β just what you absolutely need
β clean up after yourself
β after I've interacted multiple times with your app
Upgrade to a PWA if it truly brings value to your users!
but now what...?
π PRPL pattern