SlideShare a Scribd company logo
Maximiliano Firtman
@firt
Uncovering the Secrets of
Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Progressive Web Apps
An innovative new way to
create applications for
mobile devices
you write apps that look and
behave exactly like apps on
the phone
Just put them on an internet
server.
Instant distribution.
Easy to update
3years ago
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
11years ago
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
19years ago
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
0years ago
#YearOfPWA
Ideal for all those apps that are just
consuming web content or web
services
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
State of the Platform
Every Web Browser
🤔
App Support - Mobile OS
iOS 11.3+
Only from store Only from store
Careful with Social Network
Browsing
🤔
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
App Support - Desktop OS
Only from store
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Secrets
Secrets
Installation
Web App Banner
PWA Criteria
Engagement?
Installation
Add or Install?
Badging
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Installation
Badging 🤨
Install Custom Action
Install Custom Action


let installPrompt;
window.addEventListener("beforeinstallprompt", e => {
//TODO: enable Install button
e.preventDefault();
installPrompt = e;
});
JavaScript
Install Custom Action


let installPrompt;
window.addEventListener("beforeinstallprompt", e => {
//TODO: enable Install button
e.preventDefault();
installPrompt = e;
});
JavaScript
Install Custom Action


let installPrompt;
window.addEventListener("beforeinstallprompt", e => {
//TODO: enable Install button
e.preventDefault();
installPrompt = e;
});
JavaScript
Install Custom Action


let installPrompt;
window.addEventListener("beforeinstallprompt", e => {
//TODO: enable Install button
e.preventDefault();
installPrompt = e;
});
JavaScript
Install Custom Action


buttonInstall.addEventListener("click", e => {
installPrompt.prompt();
});
JavaScript
Secrets
Dev Tools
Testing and Debugging
iOS Simulator
iOS Simulator
Android Emulator
Android Emulator
Android Emulator
Localhost on Android
Localhost on Android
Localhost on Android
Localhost on Android
Localhost on Android
Chromebook Emulator
Chromebook Emulator
https://developer.android.com/topic/arc/emulator
Chromebook Emulator
Secrets
LifeCycle & Storage
Persistent Storage API


if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist();
}
JavaScript
PWA LifeCycle
First Visit Browser Loading
PWA LifeCycle
First Visit
SW Installation ⚡install
⚡activate
Browser Loading
PWA LifeCycle
First Visit
SW Installation
User installs PWA
⚡install
⚡activate
Browser Loading
⚡appinstalled
PWA LifeCycle
Second visit App Loading
❓display-mode
❓start_url
PWA LifeCycle
Second visit
App goes background
App Loading
⚡visibilitychange
❓display-mode
❓start_url
PWA LifeCycle
Second visit
App goes background
App is terminated on iOS
App Loading
⚡visibilitychange
❓display-mode
❓start_url
😣
PWA LifeCycle
Second visit
App goes background
App might be suspended
App Loading
⚡visibilitychange
❓display-mode
❓start_url
⚡freeze 🆕
PWA LifeCycle
Second visit
App goes background
App will be suspended
App Loading
⚡visibilitychange
❓display-mode
❓start_url
⚡freeze 🆕
User goes back to App ⚡resume 🆕
⚡visibilitychange
App in memory
PWA LifeCycle
Second visit
App goes background
App will be suspended
App Loading
⚡visibilitychange
❓display-mode
❓start_url
⚡freeze 🆕
User goes back to App ❓document.wasDiscarded 🆕
⚡load
App was discarded
Secrets
User Interface
Pull to Refresh
Pull to Refresh
body {
  /* Disables pull-to-refresh */
  overscroll-behavior-y: contain;
}
CSS
Avoid App Translation
Avoid App Translation
<meta name="google" content="notranslate">
HTML
Avoid App Translation


if (matchMedia('(display-mode: standalone)').matches) {

document.querySelector("head").innerHTML +=
'<meta name="google" content="notranslate">';


}
JavaScript
Secrets
Fighting Challenges
WebAPK
Link Capturing (Intents)
Careful with Link Capturing
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Uncovering Secrets of Progressive Web Apps
Use environment margins


body {
margin-top: env(safe-area-inset-top);
margin-left: env(safe-area-inset-left);
margin-bottom: env(safe-area-inset-bottom);
margin-right: env(safe-area-inset-right);
}
CSS


<meta name="viewport" content="..., viewport-fit: cover" />
HTML
Uncovering Secrets of Progressive Web Apps
Save state
Use Page Visibility API
Restore state
Uncovering Secrets of Progressive Web Apps
Use Cache Storage
Standalone PWASafari
Web Storage
IndexedDB
Cookies
Web Storage
IndexedDB
Cookies
Use Cache Storage
Standalone PWASafari
Web Storage
IndexedDB
Cookies
Web Storage
IndexedDB
Cookies
Cache Storage
Launch Images
Launch Images


<link rel="apple-touch-startup-image" 

src="image-screen-size.png">
<link rel="apple-touch-startup-image" 

src="launch-iphonex.png"
sizes="1125x2436">
HTML
Launch Images
Launch Images
Launch Images
Launch Images
Remove support for iOS
Remove support for iOS
Secrets
App Stores
App Store
App Store
WebView and LOT of native code
App Store
Trusted Web Activities
coming on Chrome 69 later this year
App Store
APK
Icons


PWA Certified
URL
TWA
Standalone mode
Store Distribution
Microsoft Store
kaiOS store coming
Play Store coming with TWA
App Store?
PWAs are great
Let’s use a critical eye
Remember our Goals
Goals
A good,
Goals
accessible,
Goals
and performant
Goals
User Experience
uee>
<blink>@firt - firt.mobi</blink>

More Related Content

Uncovering Secrets of Progressive Web Apps