Slides from my talk at NCC Group's Web Performance Day in May 2016.
Compares the features of apps and the web, what's great about each and explores some of the technologies that will allow us to build websites that can deliver native like experiences.
AWS Community Day CPH - Three problems of Terraform
Â
Building an Appier Web - May 2016
1. Building an Appier Web
@AndyDavies, NCC Group, May 2016
https://www.flickr.com/photos/alesimages/4215559895
2. Weâre spending more and more time in appsâŠ
Digital media usage time is exploding right now, and itâ
predominantly being driven by mobile apps.
476,553 480,967 550,522
409,847
621,410
778,95477,081
97,440
118,299
0
200,000
400,000
600,000
800,000
1,000,000
1,200,000
1,400,000
1,600,000
Jun-2013 Jun-2014 Jun-2015
TotalMinutes(MM)
Desktop Mobile App Mobile Browser
Growth in Digital Media Time Spent
Source: comScore Media Metrix Multi-Platform & Mobile Metrix, U.S., Total Audience
+53%
vs. 2013
+90%
vs. 2013
+16%
vs. 2013
19. And mobile audience growth is being driven more by m
properties, which are actually bigger and growing faste
Average Monthly Audience: Top 1000 Mobile Apps vs. Top 1000 Mobile Web Properties
Source: comScore Mobile Metrix, U.S., Age 18+
-
1,000
2,000
3,000
4,000
5,000
6,000
7,000
8,000
9,000
10,000
Jun-2014 Sep-2014 Dec-2014 Mar-2015 Jun-2015
UniqueVisitors(000)
Apps Mobile Web +42%
y/y
+21%
y/y
The web has great reachâŠ
20. and itâs due to the simple power of the URL
http://example.com
30. So what might we need to build it?
https://www.flickr.com/photos/aigle_dore/7912377858
31. We can already add pages to our home screen
Supported by most major mobile
operating systems and browsersâš
âš
(Bookmarks page rather than site)
32. Can specify the icon etc. via meta tags
<link rel="apple-touch-icon" href="icons/logo/ncc-logo-120x120-ios.png">
<link rel="apple-touch-icon-precomposed" href="icons/logo/ncc-logo-120x120-ios.png">
<link rel="apple-touch-startup-image" href="/images/startup.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
(Minimal iOS set, ideally need more icon and splash screen sizes
and other mobile browsers prefer different meta data)
43. Service Worker is an in-browser network proxy
that can intercept requests and responses
44. <script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js').then(function(registration) {
}).catch(function(err) {
console.log('Can't register service worker: ', err);
});
}
</script>
Register a Service Worker
48. Going offline - caching assets on startup
var cacheVersion = "v1";
var cacheResources = [
"/pwa/index.html",
"/pwa/icons/logo/ncc-logo.svg",
"/pwa/icons/ui/sprite.svg"
// etc
];
self.addEventListener('install', function(event) {
self.skipWaiting();
event.waitUntil(
caches.open(cacheVersion).then(function(cache) {
return cache.addAll(cacheResources);
})
);
});
Store a set of resources
in cache when service
worker is installed
49. Going offline - retrieving from cache on fetch
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});
On fetch, check cache for resource,
otherwise retrieve from network
59. Getting better access to native features
âą Camera
âą Location
âą NotiïŹcations
âą Alarms
âą Vibration
âą and moreâŠ
60. Powerful APIs (inc Service Worker) require HTTPS
https://www.flickr.com/photos/zebble/6080622
61. âThe future is here, itâs just unevenly distributedâ
â â â ? ?
62. Itâs being used today!
âą 3x more time spent on site
âą 40% higher re-engagement rate
âą 70% greater conversion rate for
those arriving via Homescreen
âą 3x lower data usage
63. These apps arenât packaged and deployed through stores,
theyâre just websites that took all the right vitamins
https://infrequently.org/2015/06/progressive-apps-escaping-tabs-without-losing-our-soul/
Alex Russell, Google