computer systems department, university of castilla-la ... · albacete, spain...

112
Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API Review of the HTML5 API Computer Systems Department, University of Castilla-La Mancha Albacete, Spain [email protected] 5th June 2018

Upload: hoangnga

Post on 19-Jan-2019

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Review of the HTML5 API

Computer Systems Department, University of Castilla-La ManchaAlbacete, Spain

[email protected]

5th June 2018

Page 2: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 2

Index

Introduction

API

Work in Progress

Hands on

Conclusions

Page 3: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Introduction

API

3

Index

Evolution

Hands on

Conclusions

Page 4: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 4

• API

Page 5: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 5

• API

Page 6: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 6

• API

Page 7: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 7

• API

Page 8: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 8

Semantics

API Semantics

• Giving meaning to structure

Page 9: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 9

Offline & Storage

API Offline & Storage

• App Cache

• Local Storage

• Session Storage

• Indexed DB

• File API

• Cache Storage

Page 10: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 10

Device Access

API Device Access

• Geolocation API

• Audio/Video input

• Contacts/Events

• Tilt Orientation

Page 11: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 11

Connectivity & Communication

API Connectivity & Communication

• Server Sent Events

• Web Sockets

• Webrtc

• Cross-document messaging

• Channel messaging

• Broadcasting to other browsing contexts

Page 12: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Audio

• Video

12

Multimedia

API Multimedia

Page 13: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• SVG

• Canvas

• WebGL

• CSS3 3D

• Frame Animation

13

3D Graphics, Effects

API 3D Graphics, Effects

Page 14: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Web Workers

• XMLHttpRequest 2

• Service Workers

14

Performance & Integration

API Performance & Integration

Page 15: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 15

API What?

Web Page

Web Application

Native Web Application

Page 16: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Work in Progress

16

Index

Introduction

API

Hands on

Conclusions

Page 17: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 17

Page 18: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 18

Timeline2

00

0

20

05

20

10

20

15

Dec 1999

HTML 4.01

Nov 2007

HTML Design Principles

Jan 2008

HTML5

first draft

Oct 2017

HTML5.1

Dec 2017

HTML5.2

Oct 2014

HTML5

Page 19: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 19

Timeline2

00

0

20

05

20

10

20

15

Nov 2007

HTML Design Principles

Page 20: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Compatibility

• Utility

• Interoperability

• Universal Access

20

Design Principles

Evolution Design Principles

Page 21: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Support Existing Content

• Is there a significant quantity of existent content on popular websites intended for consumption on the public web currently working as intended in multiple popular user agents?

21

Design Principles

Evolution Design Principles

Compatibility

Page 22: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Degrade Gracefully

• Web content can degrade gracefully in older or less capable user agents, even when making use of new elements, attributes, APIs and content models.

• Web browsers: • Current top mainstream• Highly popular old Web browsers• Top user agents designed to meet specific needs or address specialized markets

22

Design Principles

Evolution Design Principles

Compatibility

Page 23: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Do not Reinvent the Wheel• Pave the Cowpaths• Evolution Not Revolution

23

Design Principles

Evolution Design Principles

Compatibility

Page 24: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Solve Real Problems

• Priority of Constituencies• Users> > > >

• Secure By Design• Communicating between documents from different sites is useful,

but an unrestricted version could put user data at risk.

24

Design Principles

Evolution Design Principles

Utility

Page 25: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Separation of Concerns• Content <--> Presentation• article element do not defines details of how it is displayed• b and I elements are widely used

• DOM Consistency

25

Design Principles

Evolution Design Principles

Utility

Page 26: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Well-defined Behaviour• Avoid Needless Complexity• Handle Errors

26

Design Principles

Evolution Design Principles

Interoperability

Page 27: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

• Media Independence• work across different platforms, devices and media

• Support World Languages• Accessibility

• Access by everyone regardless of ability is essential

27

Design Principles

Evolution Design Principles

Universal Access

Page 28: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 28

Timeline2

00

0

20

05

20

10

20

15

Jan 2008

HTML5

first draft

Page 29: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 29

HTML 5 first working draft released

Evolution First working draft

Page 30: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 30

The standard is in continuous development

Evolution From HTML 5 to HTML 5.3

• Added elements

• Removed elements

• Changed elements

Page 31: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 31

Timeline2

00

0

20

05

20

10

20

15

Oct 2014

HTML5

Page 32: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 32

Timeline

Evolution From HTML 5 to HTML 5.3

Page 33: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 33

Timeline2

00

0

20

05

20

10

20

15

Oct 2017

HTML5.1

Page 34: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 34

HTML 5.1

Evolution From HTML 5 to HTML 5.3

W3C Recommendation 3 October 2017 (2nd Edition)

Page 35: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 35

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• picture and srcset attributes allow responsive image selection

• menuitem and type="context" attribute value enable authors to add functionality to the browser’s context menu

• requestAnimationFrame API allows for more efficient animation

• enqueueJob and nextJob help explain Promise resolution in terms of microtasks

• HTMLMediaElement and srcObject objects

• event-source-error, event-track-error and event-track-load events for media fetching• history.scrollRestoration to control where a users' view is directed when navigating through their history

• add "noopener" to rel and window to allow for browsing contexts to be separated

• nonce attribute on script and style to support the use of Content Security Policy

Page 36: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 36

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

picture and srcset attributes allow responsive image selection

• Srcset & sizes• Identical images• Larger or smaller depending on the device• For saving bandwith

• To test:• Use incognito mode in chrome• Load with selected size and resize using mobile view• From the smallest width, increase width and notice image resolucion changes• When page with more quality has been loaded, it always show it because it is intended for saving data

Page 37: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 37

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

picture and srcset attributes allow responsive image selection

25 Images3,43 MB

25 Images7,4 MB

25 Images113,9 MB

Page 38: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 38

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

picture and srcset attributes allow responsive image selection

Page 39: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 39

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

requestAnimationFrame API allows for more efficient animation• Execution of code on the next available screen repaint• Usually 60 times per second

• Generally match the display refresh rate in most web browsers as per W3C recommendation• window.requestAnimationFrame(callback)

• callback takes one single argument which indicates the current time (in milliseconds)

Page 40: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 40

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

requestAnimationFrame API allows for more efficient animation

Page 41: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 41

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

history.scrollRestoration to control where a users' view is directed when navigating through their history• history.scrollRestoration = ‘auto’;

• The browser restores the previous scroll position• history.scrollRestoration = 'manual’;

• The scroll is not restored by the browser

Page 42: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 42

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

add "noopener" to rel and window to allow for browsing contexts to be separated

?

Page 43: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 43

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

add "noopener" to rel and window to allow for browsing contexts to be separated

Page 44: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 44

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

add "noopener" to rel and window to allow for browsing contexts to be separated

Page 45: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 45

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

add "noopener" to rel and window to allow for browsing contexts to be separated

Page 46: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 46

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

add "noopener" to rel and window to allow for browsing contexts to be separated

Page 47: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 47

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

nonce attribute on script and style to support the use of Content Security Policy

• What is Content Security Policy?• Security layer to detect and mitigate attacks

• Cross Site Scripting (XSS)• Data Injection Attacks

Page 48: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 48

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

nonce attribute on script and style to support the use of Content Security Policy

• How to enable it?• HTTP header

• Content-Security-Policy: policy• or <meta> element

• <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';">

Page 49: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 49

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

nonce attribute on script and style to support the use of Content Security Policy

• script-src policy to allow sources• Content-Security-Policy: script-src <source> <source>;

• For example:• CSP header:

• Content-Security-Policy: script-src https://www.felixalbertos.com/• Script

• <script src=“http://www.felixalbertos.com/script/foobar/js/boot.js”></script>

Page 50: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 50

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features added (some …)

nonce attribute on script and style to support the use of Content Security Policy

• Among other values, source could be• nonce-<base64-value>• A whitelist for specific inline scripts using a cryptographic once (number used once)

• Dynamically generated, for each requested page, if it is static … :(• For example:

• Content-Security-Policy: script-src ‘nonce-kjl93204ids’• <script nonce=“kjl93204ids”>

// JavaScript code</script>

Page 51: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 51

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features removed (some …)

• appCache• Offline Web Applications, almost …

• Media Controllers• command API

• A command is the abstraction behind menu items, buttons, and links. Once a command is defined, other parts of the interface can refer to the same command, allowing many access points to a single feature

• usemap attribute on object

Why?• Sometimes nobody, or only one (Media Controllers ! ), has implemented it• Implementation is inconsistent• It doesn’t work as expected

Page 52: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 52

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features removed (some …)

• appCache• Not able to decide if serving cached or remote content• Not having control of which files are being processed • If something fails, it totally breaks

Page 53: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 53

HTML 5.1

Evolution From HTML 5 to HTML 5.3

Features changed (some …)

• accesskey takes a single character as a value (as in HTML 4)• accesibility

• header and footer elements can be nested, if each level is within a sectioning element• mousewheel event is called wheel• img and related elements support width="0“• .tFoot and .createTFoot() always insert at the end of a table

Page 54: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 54

Timeline2

00

0

20

05

20

10

20

15

Dec 2017

HTML5.2

Page 55: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 55

HTML 5.2

Evolution From HTML 5 to HTML 5.3

W3C Recommendation 14 December 2017

Page 56: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 56

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• <dialog> element

• Integration with the JavaScript module system of [ECMA-262]

• Update ARIA reference to [wai-aria-1.1], which introduces new features to improve accessibility

• allowpaymentrequest attribute of iframe, for integration with the Payment Request API [PAYMENT-REQUEST]

• allow-presentation value for the sandbox attribute of iframe, for integration with the Presentation API [PRESENTATION-API]

• Define the about:html-kind URL for MP4 media track integration

Page 57: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 57

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

<dialog> element

• The dialog element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window

• The open attribute indicates that the dialog is active and available for interaction. When the open attribute is not set, it shouldn't be shown to the user• The method show() / showModal() opens the dialog

• Closing the dialog• method close([return_value])• Property returnValue of the dialog receives the value in return_value

• When it is used with integrated forms, the submit button closes the dialog

Page 58: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 58

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

<dialog> element

Page 59: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 59

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• Integration with the JavaScript module system of [ECMA-262]

Page 60: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 60

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allowpaymentrequest attribute of iframe, for integration with the Payment Request API [PAYMENT-REQUEST]• To indicate that a cross-origin iframe is allowed to invoke the payment request API, the allowpaymentrequest

attribute can be specified on the iframe element.

• Payment-Request

• This specification standardizes an API to allow merchants (i.e. web sites selling physical or digital goods) to utilize one or more payment methods with minimal integration. User agents (e.g., browsers) facilitate the payment flow between merchant and user.

Page 61: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 61

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allowpaymentrequest attribute of iframe, for integration with the Payment Request API [PAYMENT-REQUEST]

• Payment-Request

• Fast purchase experience• Consistent experience on every site (that supports the API)• Accessibility• Credentials management• Consistent error handling

Page 62: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 62

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allowpaymentrequest attribute of iframe, for integration with the Payment Request API [PAYMENT-REQUEST]

• Payment-Request

Source: https://developers.google.com/web/fundamentals/payments/deep-dive-into-payment-request

Page 63: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 63

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allow-presentation value for the sandbox attribute of iframe, for integration with the Presentation API [PRESENTATION-API]• Allows embedders to have control over whether an iframe can start a presentation session

• Presentation API• Enable Web content to access presentation displays and use them for presenting Web content• Supported types of multimedia devices include both displays which are wired using HDMI, DVI, or the like, or

wireless, using DLNA, Chromecast, AirPlay, or Miracast.

Page 64: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 64

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allow-presentation value for the sandbox attribute of iframe, for integration with the Presentation API [PRESENTATION-API]

• Presentation API

Page 65: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 65

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allow-presentation value for the sandbox attribute of iframe, for integration with the Presentation API [PRESENTATION-API]

• Presentation API

Source: https://googlechrome.github.io/samples/presentation-api/index.html

Page 66: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 66

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features added (some …)

• allow-presentation value for the sandbox attribute of iframe, for integration with the Presentation API [PRESENTATION-API]

• Presentation API

Source: https://googlechrome.github.io/samples/presentation-api/index.html

Page 67: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 67

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Features removed (some …)

• keygen, menu and menuitem (added in 5.1) elements• inputmode attribute for textual input elements, and the dropzone attributes• showModalDialog method

Page 68: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 68

HTML 5.2

Evolution From HTML 5 to HTML 5.3

Constructions now valid HTML

• <style> within the <body>• multiple <main> elements in the DOM, so long as only one is visible to the user

• The main content area of a document includes content that is unique to that document and excludes content that is repeated across a set of documents such as site navigation links, copyright information, site logos and banners and search forms (unless the document or application’s main function is that of a search form).

why? Accessibility …

Page 69: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Hands on

Introduction

69

Index

Evolution

Conclusions

API

Page 70: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 70

Canvas, Drag Files, Local Storage

Hands on Image Editor

Page 71: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 71

Hands on Service Workers

Page 72: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 72

Hands on Service Workers

Page 73: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 73

What

Hands on Service Workers

• Proxy servers that sit between web applications, the browser, and the network

Service Workers

Web Browser

Page 74: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 74

How

Hands on Service Workers

Service Workers

Web Browser

• Intercept network requests and take appropriate action based on whether the network is available, updating assets residing on the server*

Page 75: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 75

How

Hands on Service Workers

Service Workers

Web Browser

• Intercept network requests and take appropriate action based on whether the network is available or not, assets locally cached can be used

Page 76: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 76

How

Hands on Service Workers

Page 77: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 77

Scenarios

Hands on Service Workers

• Updating assets from the server

Service Workers

Web Browser

Cache Store

Page 78: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 78

Scenarios

Hands on Service Workers

• Working offline

Service Workers

Web Browser

Cache Store

Page 79: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 79

Scenarios

Hands on Service Workers

• Check if asset is cached (yes)

Service Workers

Web Browser

Cache Store

Page 80: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 80

Scenarios

Hands on Service Workers

• Check if asset is cached (no)

Service Workers

Web Browser

Cache Store

Page 81: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 81

Scenarios

Hands on Service Workers

• Check if asset is cached (no)

Service Workers

Web Browser

Cache Store

Page 82: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 82

Lifecycle

Hands on Service Workers

• Lifecycle

Page 83: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 83

Lifecycle

Hands on Service Workers

• Register Service Workers in the Web Application

Page 84: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

You don’t have access to window objects

Service worker file run only over HTTPS server or your localhost

Service worker file must registered at the root directory of your website

Attention

Page 85: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 85

Lifecycle

Hands on Service Workers

(Configuring the Service Worker)

InstallingThe SW is registered in the browser for that site

WaitingThe SW is waiting for closing all the clients

ActivePrecious SW (if exists) is gone, new SW is able to control clients

?

Page 86: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 86

Lifecycle

Hands on Service Workers

• Some configuration for the Web Application

Page 87: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 87

Lifecycle

Hands on Service Workers

• Events• install

Page 88: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 88

Lifecycle

Hands on Service Workers

• Events• activate

Page 89: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 89

Lifecycle

Hands on Service Workers

• Events• fetch

Page 90: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 90

Lifecycle

Hands on Service Workers

• Dive into the fetch Event

Page 91: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 91

Scenarios

Hands on Service Workers

• Check if asset is cached (yes)

Service Workers

Web Browser

Cache Store

Page 92: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 92

Scenarios

Hands on Service Workers

• Check if asset is cached (no)

Service Workers

Web Browser

Cache Store

Page 93: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 93

Scenarios

Hands on Service Workers

• Check if asset is cached (no)

Service Workers

Web Browser

Cache Store

Page 94: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 94

Lifecycle

Hands on Service Workers

• Debugging tool (Chrome)• Chrome

• Application• Application

• Service Workers

• Application• Cache

• Cache Storage

Page 95: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 95

Service Workers

Hands on Native Applications

• Lessons learned• Be aware of the Browsers cache

• <ctrl><f5> updates cache … or not• <f5> shows previous version

• shift+reload a document (Debugger tools), it’ll always load without a controller, which is handy for testing quick CSS & JS changes

• Only updates when browser closes completely• But, self.skipWaiting()!

• Service Workers work as native applications --> close the browser completely for update them

• Code Consistency and Data consistency• Different browser tabs may run different code --> corrupt client-side database

?

Page 96: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 96

Service Workers

Hands on Service Workers

• Lessons learned• event.request

• Be careful when using it• console.log(event.request) ?

• Only one use• Clone

• Caches.match vs fetch• When offline always caches.match (avoid the problems I have for that mistake ;) )

• Reload the Web application to use the new version

?

Page 97: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 97

Service Workers

Hands on Service Workers

• The secret life of a Service Worker• Service Worker do not ends when the browser is closed

• Variables …

• But if the computer is restarted, the service worker starts again

Page 98: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 98

Service Workers

Hands on Service Workers

• *Bonus• Communication between the Web Application and the Service Worker

• Using MessageChannel

• Push notifications

• Background sync API

Page 99: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 99

MessageChannel

Hands on Service Workers

• Part of the Channel Messaging API• Allows the creation of a new

message channel

• Send / Receive data through it via its two MessagePort properties

Client Side

Page 100: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 100

MessageChannel

Hands on Service Workers

Client Side Service Workers Side

Page 101: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 101

MessageChannel

Hands on Service Workers

• Execution• Creation of the MessageChannel

• (using the previous class)

• Send the message• (exec method)

• Read the result• PromiseValue

Execution on the Console Execution on a Web Application

Page 102: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 102

Push Notifications

Hands on Service Workers

• Push Notifications• The Notifications API displays notifications to the user

• It is incredibly powerful and simple to use

• Where possible, it uses the same mechanisms a native app would use, giving a completely native look and feel

Page 103: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 103

Push Notifications

Hands on Service Workers

• Push Notifications• First request permission for sending notifications

• Notification.requestPermission

• If granted• showNotification method to send notifications

Page 104: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 104

Push Notifications

Hands on Service Workers

• Case Study 1• Show an invitation to the user for participating in a conference

Page 105: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 105

Push Notifications

Hands on Service Workers

• Case Study 1• Show an invitation to the user for participating in a conference

Page 106: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 106

Push Notifications

Hands on Service Workers

• Case Study 2• Remember the user to complete the registration process

Page 107: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 107

Push Notifications

Hands on Service Workers

• Case Study 2• Remember the user to complete the registration process

Page 108: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

API

Introduction

108

Index

Evolution

Hands on

ConclusionsConclusions

Page 109: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 109

Conclussions

Conclusions

Page 110: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 110

Conclusions

• Why, When, How

Page 111: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API 111

• Why, When, How

one of the most interesting terraces in Spain to have some

"tapas"

Mastropiero Terrace

Page 112: Computer Systems Department, University of Castilla-La ... · Albacete, Spain felix.albertos@uclm.es 5th June 2018. Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Félix Albertos Marco ICWE 2018 TUTORIAL Review of the HTML5 API

Review of the HTML5 API

Computer Systems Department, University of Castilla-La ManchaAlbacete, Spain

[email protected]

5th June 2018