the web - what it has, what it lacks and where it must go - keynote at riga dev day

108
The Web - What it Has, What it Lacks and Where it Must Go @robertnyman

Upload: robert-nyman

Post on 13-Apr-2017

8.343 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The Web - What it Has, What it Lacks and Where it Must Go @robertnyman

Page 2: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day
Page 3: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day
Page 4: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day
Page 5: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

People also bought…

Page 6: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day
Page 7: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day
Page 8: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

My role at Google

Page 9: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

My role at Google

https://developers.google.com/android/

https://developers.google.com/ios/

https://developers.google.com/web/

Page 10: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

My role at Google

Page 11: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

My role at Google - https://medium.com/latest-from-google

Page 12: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

My role at Google - understanding trends

Page 13: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today The web vs. native

Tools & resources from Google SLICE

Why do developers need a native app? Monetization

Future of the web

Page 14: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

Page 15: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

Page 17: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

One billion active users

Page 18: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Building a web site?

No, initially we're targeting mobile

devices…

Page 19: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web is both desktop & mobile!

Page 20: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

Page 21: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

Page 22: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web as of today

Morgan Stanley: the web is winning

Page 23: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

Page 24: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

Visitor traffic to top companies/services

Page 25: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

comScore: 87% of time on mobile spent in appsNative is winning

Page 26: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

10% of time on mobile spent in the browser

Page 27: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

10% of time on mobile spent in the browser

Page 28: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

?

Page 30: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

Facebook

One billion daily users,

where 844 million daily users are on mobile

Page 31: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

…and these 7 products also have more than one billion users:

Page 32: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

Page 33: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web vs. native

Page 34: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Tools & measures from

Google

Page 35: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

App install interstitials being

non-mobile friendly

Page 36: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

App install interstitials being non-mobile friendly

Page 37: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Mobile-Friendly Test

Page 38: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Mobile-Friendly Test

https://www.google.com/webmasters/tools/mobile-friendly/

Page 39: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Communications & the web

Page 41: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Communications & the web

https://hangouts.google.com/

Page 42: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Communications & the web

WebRTC

Desktop:Microsoft EdgeGoogle ChromeMozilla FirefoxOpera

Android:Google ChromeMozilla FirefoxOpera Mobile

Chrome OSFirefox OS

Page 43: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Chrome DevTools

Page 44: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Chrome DevTools

https://developers.google.com/web/tools/chrome-devtools/

Page 45: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Web Fundamentals

Page 46: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Web Fundamentals

https://developers.google.com/web/fundamentals/

Page 47: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Chrome Custom Tabs

Page 48: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Chrome Custom Tabs

https://developer.chrome.com/multidevice/android/customtabs

Page 49: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

SLICE

Page 50: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Google influencers

Paul Kinlan Jake Archibald Alex Russell Paul Lewis + many more

Page 51: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

The web, moving forward

Build instantly engaging sites and apps without the need for a mandatory app download

Page 54: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

SLICE

Indexable

Page 57: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Things could be a lot easier

Page 58: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Things could be a lot easier

Page 59: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Don't make your users feel like this

Page 60: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Why do developers need a native app?

Page 61: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Performance

Sensors

OS-specific features

Offline accessPeriodic background processing

Notifications

Why do developers need a native app?

From Brian Kennan

Page 62: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Performance

Sensors

OS-specific features

Offline access

Periodic background processing

Notifications

Why do developers need a native app?

From Brian Kennan

Page 63: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Initiatives to address this

New web features

Page 64: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Offline access =>

Service Workers

Service Workers

Page 65: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

It's a JavaScript Worker, so it can't access the DOM directly. Instead responds to postMessages

Service worker is a programmable network proxy

It will be terminated when not in use, and restarted when it's next needed

Makes extensive use of Promises

Service Workers

Page 66: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

HTTPS is Needed

Service Workers

Page 67: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Register and Installing a Service Worker

if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').then(function(registration) { // Registration was successful console.log('ServiceWorker registration successful with scope: ', registration.scope); }).catch(function(err) { // registration failed :( console.log('ServiceWorker registration failed: ', err); });}

Page 68: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

chrome://inspect/#service-workers chrome://serviceworker-internals/

Service Workers

Page 69: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

// The files we want to cachevar urlsToCache = [ '/', '/styles/main.css', '/script/main.js']; // Set the callback for the install stepself.addEventListener('install', function(event) { // Perform install steps});

Installing a Service Worker

Page 70: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Inside our install callback:

1. Open a cache 2. Cache our files 3. Confirm whether all the required assets are cached or not

Installing a Service Worker

Page 71: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Install callback

var CACHE_NAME = 'my-site-cache-v1'; var urlsToCache = [ '/', '/styles/main.css', '/script/main.js']; self.addEventListener('install', function(event) { // Perform install steps event.waitUntil( caches.open(CACHE_NAME) .then(function(cache) { console.log('Opened cache'); return cache.addAll(urlsToCache); }) );});

Page 72: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

self.addEventListener('fetch', function(event) { event.respondWith( caches.match(event.request) .then(function(response) { // Cache hit - return response if (response) { return response; } return fetch(event.request); } ) );});

Caching and Returning Requests

Page 73: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Updating a Service Worker

Page 74: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

1. Update your service worker JavaScript file. 2. Your new service worker will be started and the

install event will be fired. 3. New Service Worker will enter a "waiting" state 4. When open pages are closed, the old Service

Worker will be killed - new service worker will take control.

5. Once new Service Worker takes control, its activate event will be fired.

Updating a Service Worker

Page 75: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Instant Loading Web Apps with An Application Shell Architecture

Application Shell

Page 78: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Periodic background processing =>

Background Sync

Page 80: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Background Sync

Chrome Dev for Android or Chrome Canary for desktop

chrome://flags/#enable-experimental-web-platform-features

Restart the browser

Page 81: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Notifications =>

Push notifications

Page 82: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Push notifications

Page 83: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

// Are Notifications supported in the service worker? if (!('showNotification' in ServiceWorkerRegistration.prototype)) { console.warn('Notifications aren\'t supported.'); return; }

Push notifications

Page 84: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

// Check the current Notification permission. // If its denied, it's a permanent block until the // user changes the permission if (Notification.permission === 'denied') { console.warn('The user has blocked notifications.'); return; }

Push notifications

Page 85: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

// Check if push messaging is supported if (!('PushManager' in window)) { console.warn('Push messaging isn\'t supported.'); return; }

Push notifications

Page 86: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

// We need the service worker registration to check for a subscription navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { // Do we already have a push message subscription? serviceWorkerRegistration.pushManager.getSubscription() .then(function(subscription) { // Enable any UI which subscribes / unsubscribes from // push messages. var pushButton = document.querySelector('.js-push-button'); pushButton.disabled = false; if (!subscription) { // We aren't subscribed to push, so set UI // to allow the user to enable push return; } // Keep your server in sync with the latest subscriptionId sendSubscriptionToServer(subscription); // Set your UI to show they have subscribed for // push messages pushButton.textContent = 'Disable Push Messages'; isPushEnabled = true; }) .catch(function(err) { console.warn('Error during getSubscription()', err); }); }); Push notifications

Page 87: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

{ "name": "Push Demo", "short_name": "Push Demo", "icons": [{ "src": "images/icon-192x192.png", "sizes": "192x192", "type": "image/png" }], "start_url": "/index.html?homescreen=1", "display": "standalone"}

<link rel="manifest" href="manifest.json">

Push notifications

Page 88: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Add to Homescreen

Page 89: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Cache management & whitelistsApp Install Banners

Page 90: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

App Install Banners prerequisites

You have a web app manifest file

You have a service worker registered on your site. We recommend a simple custom offline page service worker

Your site is served over HTTPS (you need a service worker after all)

The user has visited your site twice over two separate days during the course of two weeks.

Page 91: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

All this leads to progressive

apps

Page 92: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Progressive Apps

These apps aren’t packaged and deployed through stores, they’re just websites that took all the right vitamins.

They keep the web’s ask-when-you-need-it permission model and add in new capabilities like being top-level in your task switcher, on your home screen, and in your notification tray

- Alex Russell

Page 95: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Monetization

Page 96: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Page 97: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Why the web?

Page 98: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Native platforms needs to be matched and surpassed

Page 99: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Getting people back to using URLs, sharing things online and making it

accessible across all platforms

Page 100: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Go simple

Page 101: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Go simple

Right now the onboarding process for a (front-end) web developer is much harder than it

was before

Page 102: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Go simple

We've gone from HTML, CSS and JavaScript to incredibly complex solutions, build scripts &

workflows

Page 103: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Spread the word about what the web can do

Page 104: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Future of the web

Longevity of the web

Where stuff being built will still work 10 years down the line

Page 106: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day

Help keep the diversity of the web

Page 107: The web - What it has, what it lacks and where it must go - keynote at Riga Dev Day