making html5 work everywhere

57
Todd Anglin @toddanglin Telerik

Upload: todd-anglin

Post on 15-Jan-2015

525 views

Category:

Software


1 download

DESCRIPTION

One of the great promises of HTML5 is that you can create software that runs everywhere. In many ways, HTML5 lives-up to this promise, but as with any evolving standard, support across different browsers and devices is inconsistent. To effectively adopt HTML5 today, developers must master the skills that fill-in the gaps and minimize the differences between HTML5 runtimes. In this session, you will learn the essential techniques needed to create HTML5 sites and apps that truly work everywhere. You will learn: • Learn four strategies for adopting HTML5 • Analyze the impact browsers have on HTML5 readiness & adoption • Explore new HTML5 features and techniques for using in older browsers

TRANSCRIPT

Page 1: Making HTML5 Work Everywhere

Todd Anglin@toddanglin

Telerik

Page 2: Making HTML5 Work Everywhere

Todd Anglin@toddanglin

Telerik

Page 3: Making HTML5 Work Everywhere
Page 4: Making HTML5 Work Everywhere

EVP Product Strategy, Telerik5x Microsoft MVP, ASP Insider, O'Reilly Author

@toddanglin

Page 5: Making HTML5 Work Everywhere

Session Road Map

Understanding the Evolution

Adoption Strategies

Applied Techniques

Goal: Leave with at least 1 HTML5/CSS3 technique you can use today

Page 6: Making HTML5 Work Everywhere

“While it continues to serve as a rough guide to many of the core features of HTML, it does not provide enough information to build implementations that interoperate with each other and, more importantly, with a critical mass of deployed content.”

-W3C on HTML4

Page 7: Making HTML5 Work Everywhere

HTML4 = Rough Guide

Unpredictable Browser Support

Page 8: Making HTML5 Work Everywhere

How is the web evolving?

Page 9: Making HTML5 Work Everywhere

<HTML>CSS:3;

ECMAScript();{ }“HTML5”

Page 10: Making HTML5 Work Everywhere

“Living Standard”

WebSockets FileAPI WebGL

HTML5 FormsGeolocation

Offline

Canvas

Video

Audio

Canvas

Video

Geolocation

Semantic Tags

SVGWHATWG | W3C | IETF

Page 11: Making HTML5 Work Everywhere

Where is everywhere?(Which browsers matter?)

Page 12: Making HTML5 Work Everywhere

Know your users.Know your browsers.

Page 13: Making HTML5 Work Everywhere

of internet browses withIE, FF, Safari, Chrome, or Opera

99%

Page 14: Making HTML5 Work Everywhere
Page 15: Making HTML5 Work Everywhere
Page 16: Making HTML5 Work Everywhere
Page 17: Making HTML5 Work Everywhere
Page 18: Making HTML5 Work Everywhere
Page 19: Making HTML5 Work Everywhere
Page 20: Making HTML5 Work Everywhere

IE9 offers support for the most relevant, real-world web patterns that developers are using today as well as the HTML5 patterns we expect to become more mainstream.”

Dean HachamovitchCorporate VP, IE

Page 21: Making HTML5 Work Everywhere

WD LC CR PR REC

Page 22: Making HTML5 Work Everywhere

In the future, browsers compete

on speed, not on features

Page 23: Making HTML5 Work Everywhere

In the future, browsers update

automatically and often

Page 24: Making HTML5 Work Everywhere

What is usable today?

Page 25: Making HTML5 Work Everywhere

X X X X X

X X X

X X

X X X

X X

Adoption Strategies

Lowest Common DominatorOnly use features natively available in all target browsers

Page 26: Making HTML5 Work Everywhere

X X X X X

X X X

X X

X X X

X X

Adoption Strategies

Polyfill EnrichedOnly use features either natively available OR available via JavaScript polyfill

X X

Page 27: Making HTML5 Work Everywhere

polyfill(n) poly • fill: JavaScript that implants HTML5 functionality in a browser that does not offer native support

Page 28: Making HTML5 Work Everywhere

X X X X X

X X X

X X

X X X

X X

Adoption Strategies

Alternate ExperiencesOnly use features available in target browsers AND design alternate experience for other browsers

X X

X X X

X X

Page 29: Making HTML5 Work Everywhere

progressiveenhancementgracefuldegradation

Page 30: Making HTML5 Work Everywhere

[Source: Aaron Olaf, Flickr]

Page 31: Making HTML5 Work Everywhere

[Source: Mercedes USA, http://mbusa.com/]

Page 32: Making HTML5 Work Everywhere

X X X X X

X X X

X X

X X X

X X

Adoption Strategies

Vertical TargetCreate experiences targeted at specific browsers (or classes of browsers)

X X

X X X

X X

Page 33: Making HTML5 Work Everywhere

11:05

Page 34: Making HTML5 Work Everywhere

$(“code”).show();

Page 35: Making HTML5 Work Everywhere

STRATEGY #1Lowest Common Denominator

Page 36: Making HTML5 Work Everywhere

THANKS FOR ATTENDING!Don’t forget to fill-out your evals.

The end.

Page 37: Making HTML5 Work Everywhere

Inte

rnet E

xplo

rer 6

»

Inte

rnet E

xplo

rer 7

»

Inte

rnet E

xplo

rer 8

»

Inte

rnet E

xplo

rer 9

»

Win

Phone 7.5

»

Android

4.0

»

Android

4.3

»

Safari

5.1 »

Win

Phone 8 »

Opera

11.6

0 »

Firefo

x 8 »

Chrom

e 17 »

Safari

6.0 »

iOS 6

.0 »

Opera

12 »

Chrom

e Mobile

»

Safari

7.0 »

iOS 7

.0 »

Firefo

x 24 »

Chrom

e 22 »

Firefo

x 28 »

Chrom

e 32 »

Chrom

e 33 »

0

100

200

300

400

500

600

25 26 41

138138

286287303320329337374378386389390397415430434448

498505

relative HTML5 scores

IE10

IE11

HTML5Test.com

Page 38: Making HTML5 Work Everywhere

IE6 IE7 IE8 IE9 IE10 IE11*0

102030405060708090

Supported HTML5/CSS3 FeaturesF

eatu

re C

ou

nt

As reported by CanIUse.com

Page 39: Making HTML5 Work Everywhere

Selectors (2.1)position:fixed

7.0 LocalStorageDragDrop API

JSONquerySelector

8.0

VideoAudioWOFFSVG

CanvasGeolocation

Semantic TagsLots of CSS3

9.0

XHR2Web WorkersWeb SocketsIndexedDBHistory API

File APICORS

Blob URLsTyped ArraysDefer/Async

Form ValidationNew Input Types

Offline App CacheMuch more CSS3

10.0

Page 40: Making HTML5 Work Everywhere

Don't sniff browsers.(Test for features.)

Page 41: Making HTML5 Work Everywhere

modernizr

Page 42: Making HTML5 Work Everywhere

Modernizr.[featureName]

if (Modernizr.canvas) { //Use It! }

.[featureName] || .no-[featureName]

.no-canvas { //Styles }

.canvas { //Other Styles}

Page 43: Making HTML5 Work Everywhere

DEMOModernizr

Page 44: Making HTML5 Work Everywhere

<meta http-equiv="X-UA-Compatible" content="chrome=1">

Page 45: Making HTML5 Work Everywhere

Inte

rnet

Exp

lorer

6 »

Inte

rnet

Exp

lorer

7 »

Inte

rnet

Exp

lorer

8 »

Inte

rnet

Exp

lorer

9 »

Safar

i 5.1

»

Inte

rnet

Exp

lorer

10

»

Ope

ra 1

1.60

»

Firefo

x 8

»

Chrom

e 17

»

Safar

i 6.0

»

Ope

ra 1

2 »

Chrom

e 22

»0

50100150200250300350400450500

25 26 41138

303 320 329 337 374 378 389434

relative HTML5 scores

Page 47: Making HTML5 Work Everywhere

STRATEGY #2Polyfill Enriched

Page 48: Making HTML5 Work Everywhere

Not all polyfills are created equal.

Page 49: Making HTML5 Work Everywhere

OldEquivalent

Plug-inBacked

JavaScriptPowered

Use legacy versions of

same feature

Implement feature using

JavaScript

Map browser feature to

plug-in feature

Memory & speed friendly

Limited API coverage

Portable & more completeCan be slow & memory hog

Complete API & speedy

Requires (user installed) plug-in

Page 50: Making HTML5 Work Everywhere

OldEquivalent

Plug-inBacked

JavaScriptPowered

• Fonts• LocalStorag

e• Semantic

Tags• Opacity• CORS

• CSS3 Selectors

• CSS Layouts

• Forms• Validation• JSON• Canvas*

• Database• Canvas*

html5please.com

Page 51: Making HTML5 Work Everywhere

Semantic Tags

Local Storage

Form ValidationGeolocation

CSS3 Selectors

Page 52: Making HTML5 Work Everywhere

STRATEGY #3

Graceful Degradation & Progressive Enhancement

Page 53: Making HTML5 Work Everywhere

exit PowerPoint; exec Demos;

Page 54: Making HTML5 Work Everywhere

Safe WarningCaution

• Relies on old native browser feature

• Does not interact with DOM/rendering

• Uses a plug-in (Flash/Gears) to do heavy lifting

Polyfill Guidance

• Large amount of JavaScript required

• Manipulates DOM/layout

• Superficial benefit (ex: rounded corners)

• Attempts to change rendering (CSS)

• Requires execution on page load

Page 55: Making HTML5 Work Everywhere
Page 56: Making HTML5 Work Everywhere

Which HTML5/CSS3 technique will you try today?

Page 57: Making HTML5 Work Everywhere

Todd Anglin@[email protected]

Thanks!