HTML5 Who what where when why how

70
HTML5 Who what where when why how Bruce Lawson

Transcript of HTML5 Who what where when why how

Page 1: HTML5 Who what where when why how

HTML5Who what where when why how

Bruce Lawson

Page 2: HTML5 Who what where when why how
Page 3: HTML5 Who what where when why how

Archiutect pic

Page 4: HTML5 Who what where when why how
Page 5: HTML5 Who what where when why how
Page 6: HTML5 Who what where when why how
Page 7: HTML5 Who what where when why how
Page 8: HTML5 Who what where when why how
Page 9: HTML5 Who what where when why how
Page 10: HTML5 Who what where when why how

XHTML 2<img />

Page 11: HTML5 Who what where when why how

Thank you @mamipekohttp://d.hatena.ne.jp/Mamipeko/

Page 12: HTML5 Who what where when why how
Page 13: HTML5 Who what where when why how

© Copyright 2004-2010 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. You are granted a license to use, reproduce and create derivative works of this document.

http://www.whatwg.org/specs/web-apps/current-work/

Page 14: HTML5 Who what where when why how
Page 15: HTML5 Who what where when why how

2007 W3C HTML group revived

Page 16: HTML5 Who what where when why how
Page 17: HTML5 Who what where when why how
Page 18: HTML5 Who what where when why how
Page 19: HTML5 Who what where when why how

Why HTML5 wins

● Backwards compatibility, and a clear migration path.

● Well-defined error handling.

● Users should not be exposed to authoring errors.

Page 20: HTML5 Who what where when why how

exciting demo

Page 21: HTML5 Who what where when why how

<b><i>Yo!</b></i>

Page 22: HTML5 Who what where when why how

<b><i>Yo!</b></i>IE, Safari

<!DOCTYPE HTML><html><HEAD></HEAD><BODY><B><I>Yo!</I></B><I></I></BODY></html>

Opera, Firefox, Chrome

<!DOCTYPE HTML><html><head></head><body><b><i>Yo!</b></i></body></html>

http://software.hixie.ch/utilities/js/live-dom-viewer

Page 23: HTML5 Who what where when why how

HTML5 does not replace HTML 4.01

Page 24: HTML5 Who what where when why how

HTML5 has more bling!

Page 25: HTML5 Who what where when why how

HTML5 is umbrella term:markup elements and JavaScript APIs

Page 26: HTML5 Who what where when why how

30 new elements 30 new elements

Page 27: HTML5 Who what where when why how
Page 28: HTML5 Who what where when why how

Top 20 class names1. footer 11. button

2. menu 12. main

3. style1 13. style3

4. msonormal 14. small

5. text 15. nav

6. content 16. clear

7. title 17. search

8. style2 18. style4

9. header 19. logo

10. copyright 20. body

http://devfiles.myopera.com/articles/572/classlist-url.htm

Page 29: HTML5 Who what where when why how

Top 20 id names1. footer 11. search

2. content 12. nav

3. header 13. wrapper

4. logo 14. top

5. container 15. table2

6. main 16. layer2

7. table1 17. sidebar

8. menu 18. image1

9. layer1 19. banner

10. autonumber1 20. navigation

http://devfiles.myopera.com/articles/572/idlist-url.htm

Page 30: HTML5 Who what where when why how
Page 31: HTML5 Who what where when why how

Webforms – more powerful form elements

Page 32: HTML5 Who what where when why how
Page 33: HTML5 Who what where when why how

standardise commonly-usedrich form elements – without JavaScript

Page 34: HTML5 Who what where when why how

built-in validation(of course you should still validate on the server)

<input type=email><input type=url required>

<input type=range min=10 max=100><input type=date min=2010-01-01 max=2010-12-31>

<input pattern="[0-9][A-Z]{3}" placeholder="9AAA">http://people.opera.com/brucel/demo/html5-forms-demo.html

Page 35: HTML5 Who what where when why how
Page 36: HTML5 Who what where when why how
Page 37: HTML5 Who what where when why how
Page 38: HTML5 Who what where when why how

<video>

Page 39: HTML5 Who what where when why how

“...extending the language to better support Web applications, since that is one of the directions the Web is going in and is one of the areas least well served by HTML so far. This puts HTML in direct competition with other technologies intended for applications deployed over the Web, in particular Flash and Silverlight.”

Ian Hickson, Editor of HTML5http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html

Page 40: HTML5 Who what where when why how

<object width="425" height="344"><param name="movie"

value="http://www.example.com/v/9sEI1AUFJKw&hl=en&fs=1&"></param>

<param name="allowFullScreen" value="true"></param>

<param name="allowscriptaccess" value="always"></param>

<embed src="http://www.example.com/v/9sEI1AUFJKw&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

Page 41: HTML5 Who what where when why how

<video src=pudding.ogv controls autoplay poster=poster.jpg width=320 height=240> <a href=video.ogv>Download movie</a></video>

Page 42: HTML5 Who what where when why how

All things are connectedAll things are connected

Page 43: HTML5 Who what where when why how

video as native object...why is it important?

● “play nice” with rest of the page● keyboard accessibility built-in● API for controls

Page 44: HTML5 Who what where when why how

offline support

Page 45: HTML5 Who what where when why how

detect if a browsers goes offline

window.addEventListener('online', function(){ … }, true);window.addEventListener('offline', function(){ … }, true);

Page 46: HTML5 Who what where when why how

storage

Page 47: HTML5 Who what where when why how

localStorage/sessionStoragelike cookies...

document.cookie = 'key=value; expires=Thu, 15 Feb 2010 23:59:59 UTC; path=/'…/* convoluted string operations go here … */

Page 48: HTML5 Who what where when why how

localStorage/sessionStoragelike cookies...on steroids!

localStorage.setItem(key, value);localStorage.getItem(key);localStorage.clear();localStorage.key = value;if (localStorage.key == '…') { … }…

Page 49: HTML5 Who what where when why how

Web Database – full relational DB / SQL

var db =openDatabase(dbName, version, displayName, expectedSize);db.transaction(function(tx) {

tx.executeSql(sqlStatement, [], function (tx, result) { /* do something with the results */

});});

Page 50: HTML5 Who what where when why how

application cache

Page 51: HTML5 Who what where when why how

cache UI/resource files for offline use

<html manifest=”blah.manifest”>CACHE MANIFEST# send this with correct text/cache-manifest MIMEimages/sprites.pngscripts/common.jsscripts/jquery.jsstyles/global.css

Page 52: HTML5 Who what where when why how

is it all safe to use, right now?

Page 53: HTML5 Who what where when why how
Page 54: HTML5 Who what where when why how

feature-detectionprogressive enhancement, graceful degradation

http://diveinto.html5doctor.com/everything.html

Page 55: HTML5 Who what where when why how

feature-detection for audio/video

if (!!document.createElement('video').canPlayType;) { … }if (!!document.createElement('audio').canPlayType;) { … }

Page 56: HTML5 Who what where when why how

<html class="no-js">

<html class="js canvas canvastext no-geolocation rgba hsla multiplebgs borderimage borderradius boxshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions video audio

localstorage sessionstorage webworkers applicationcache fontface">

Modernizr.canvasModernizr.inputtypes.email

Page 57: HTML5 Who what where when why how
Page 58: HTML5 Who what where when why how
Page 59: HTML5 Who what where when why how
Page 60: HTML5 Who what where when why how

patching older browsersgithub.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills

Page 61: HTML5 Who what where when why how

yepnope({ test : Modernizr.hashchange && Modernizr.history, nope : 'resources/jquery.ba-hashchange.js' });

http://net.tutsplus.com/tutorials/javascript-ajax/easy-script-loading-with-yepnope-js/

Page 62: HTML5 Who what where when why how

getUserMedia API(previously known as "HTML5 <device>")

Page 63: HTML5 Who what where when why how

<video autoplay></video><script>var video = document.querySelector(video);

If (navigator.getUserMedia) {navigator.getUserMedia('video',successCallback, errorCallback);

function successCallback(stream) { video.src = stream; }...</script>

Page 64: HTML5 Who what where when why how

my.opera.com/core/blog/2011/03/23/webcam-orientation-preview

Page 65: HTML5 Who what where when why how

WebRTC is a free, open project that enables web browsers with Real-Time Communications (RTC) capabilities via

simple Javascript APIs. The WebRTC components have been optimized to best serve this purpose.

The WebRTC initiative is a project supported by Google, Mozilla and Opera.

http://sites.google.com/site/webrtc/http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing-

and-peer-to-peer-communication.html

Page 66: HTML5 Who what where when why how

"We expect to see WebRTC support in Firefox, Opera, and Chrome soon!"

http://www.webrtc.org/

Page 67: HTML5 Who what where when why how
Page 68: HTML5 Who what where when why how

Photo creditsCrowd goes wild

http://www.flickr.com/photos/specialk-files/428060061/sizes/m/in/photostream/

Mamipeko's nails and face by Mamipeko, @mamipekohttp://d.hatena.ne.jp/Mamipeko/ used with permission

All 5 Mamipeko's nails togetherhttp://www.flickr.com/photos/drzuco/4826509298/sizes/o/in/photostream/ (with permission)

Gigapudding video used with kind permission of Takura Tomy

HTML5 nazi-killing Bruce on unicorn picture by Marina Lawson. Buy her Dad's book.

Microsoft clippy belongs to Microsoft. But is loved by the world.

All others, me (all rights reserved) or (I believe) public domain.

Page 69: HTML5 Who what where when why how