Brave new world of HTML5
Patrick H. Lauke / WebTech 2010 / Milano / 9 Novembre 2010
CONTEXTUALISING THE NEW TECHNOLOGIES
Web Evangelist at Opera
...should I use HTML5 today?
www.textfiles.com/underconstruction
"there is already a lot of excitement for HTML5,
but it’s a little too early to deploy it because
we’re running into inter...
http://www.flickr.com/photos/24374884@N08/4603715307/
HTML5…without the hype?
A brief history of HTML5
1999 HTML 4.01
2000 XHTML 1.0
2004 W3C focus on XHTML 2.0
…the future is XML-based!
http://www.flickr.com/photos/craiga/17071467/
WHATWGWeb Hypertext Application Technology Working Group
2007 W3C HTML5 WG
“...extending the language to better support
Web applications [...] This puts HTML in
direct competition with other
techno...
HTML5 does not replace HTML 4.01 / XHTML 1.0
HTML5 has more bling!
HTML5 specification for
browser developers
(how to interpret markup/code – no more reverse engineering)
for authors: HTML5...
1. syntax/semantic
2. forms
3. multimedia
1. syntax/semantic
2. forms
3. multimedia
HTML5 standardises
current browser behaviour
(e.g. “relaxed” coding rules)
the dirty secret of the
doctype
XHTML 1.0<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
HTML5
<!DOCTYPE html>
<meta charset=”utf-8” />
<meta charset=utf-8>
<MeTa CHarSet=utf-8>
<style type=”text/css”>
</style>
<script type=”text/javascript”>
</script>
<style type=”text/css”>
</style>
<script type=”text/javascript”>
</script>
<!doctype html>
<title>Minimal HTML5</title>
new elemente for more accurate semantics
Top 20 class names
1. footer 11. button
2. menu 12. main
3. style1 13. style3
4. msonormal 14. small
5. text 15. nav
6. co...
Top 20 id names
1. footer 11. search
2. content 12. nav
3. header 13. wrapper
4. logo 14. top
5. container 15. table2
6. m...
unambiguous and machine readable
...e.g. screenreaders?
new and old browsers “support” these
(although some need a little extra help)
header, footer, … { display: block; }
Internet Explorer <9 needs extra training wheels
document.createElement('header');
document.createElement('footer');
…
htt...
1. syntax/semantics
2. forms
3. multimedia
improved form elements
because the web is more interactive
jqueryui.com
rich form elements – without faking them in JS
<input type=”date”>
<input type=”time”>
<input type=”month”>
<input type=”w...
types und attributes with
built-in validation
<input … required>
<input type=”tel”>
<input type=”email”>
<input type=”url”...
1. syntax/semantics
2. forms
3. multimedia
making your site Fonzie compliant...
<video>
Adobe Flash currently most common
video delivery mechanism
<object width="425" height="344">
<param name="movie"
value="http://www.youtube.com/v/9sEI1AUFJKw&hl=en
&fs=1&"></param>
<...
<video src="video.webm"
controls
autoplay
loop
preload
poster="poster.jpg"
width="320" height="240">
<a href="video.webm">...
video as native object
●
behaves like any other HTML element
●
keyboard accessibility out-of-the-box
powerful (simple) API
www.w3.org/TR/html5/video.html#media-elements
controlling <video> with JavaScript
var v = document.getElementById('player');
v.play();
v.pause();
v.volume = … ;
v.curre...
events fired by <video>
var v = document.getElementById('player');
v.addEventListener('loadeddata', function() { … }, true...
video formats
the big debate?
HTML5 does not specify
video container/codec
(same as with images in HTML 4?)
MP4 / H.264
ubiquitous, patent encumbered, licensing/royalties
Ogg Theora
free and open, no licensing fees
not many tools for it, not web optimised
WebM / VP8
open and royalty-free, web-optimised
support by hardware and software vendors
providing multiple sources
<video controls autoplay poster="…" width="…" height="…">
<source src="movie.mp4" type="video/m...
flash fallback for older browsers
http://camendesign.com/code/video_for_everybody
<video controls autoplay poster="…" width="…" height="…">
<source src="movie.mp4" type="video/mp4" />
<source src="movie.w...
<audio>
audio...exactly the same as video
<audio src=”music.mp3” controls autoplay … ></audio>
<audio controls autoplay>
<source s...
<canvas>
canvas = “scriptable images”
<canvas width="…" height="…"></canvas>
canvas has standard API methods for drawing
ctx = canvas.getContext("2d");
ctx.fillRect(x, y, width, height);
ctx.beginPat...
canvas accessibility?
video, audio and canvas
on all devices without plugins
(Java / Flash / Silverlight not ubiquitous)
HTML5 (and friends) has
lots more APIs for developers
(for powerful client-side apps)
isgeolocationpartofhtml5.com
geolocation
navigator.geolocation.getCurrentPosition(success, error);
navigator.geolocation.watchCurrentPosition(success, ...
offline detection...
window.addEventListener('online', function(){ … }, true);
window.addEventListener('offline', function...
is it all safe to use, right now?
www.youtube.com/html5
don't do browser sniffing
http://www.flickr.com/photos/timdorr/2096272747/
feature-detection
progressive enhancement, graceful degradation
http://diveintohtml5.org/everything.html
feature-detection for audio/video
if (!!document.createElement('video').canPlayType;) { … }
if (!!document.createElement('...
patching older browsers
github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
sublimevideo.net
videojs.com
www.happyworm.com/jquery/jplayer
HTML5 as Flashkiller?
not a question of
HTML5 replacing Flash...
giving developers a choice!
...should I use HTML5 today?
“The future is already here – it's
just not very evenly distributed”
William Gibson
www.opera.com/developer
people.opera.com/patrickl/presentations/webtech_09.11.2010/webtech_09.11.2010.pdf
patrick.lauke@op...
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Upcoming SlideShare
Loading in...5
×

Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010

1,715

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,715
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010

  1. 1. Brave new world of HTML5 Patrick H. Lauke / WebTech 2010 / Milano / 9 Novembre 2010 CONTEXTUALISING THE NEW TECHNOLOGIES
  2. 2. Web Evangelist at Opera
  3. 3. ...should I use HTML5 today?
  4. 4. www.textfiles.com/underconstruction
  5. 5. "there is already a lot of excitement for HTML5, but it’s a little too early to deploy it because we’re running into interoperability issues." Philippe Le Hegaret, W3C interaction domain leader blogs.techrepublic.com.com/hiner/?p=6369
  6. 6. http://www.flickr.com/photos/24374884@N08/4603715307/
  7. 7. HTML5…without the hype?
  8. 8. A brief history of HTML5 1999 HTML 4.01 2000 XHTML 1.0
  9. 9. 2004 W3C focus on XHTML 2.0 …the future is XML-based! http://www.flickr.com/photos/craiga/17071467/
  10. 10. WHATWGWeb Hypertext Application Technology Working Group
  11. 11. 2007 W3C HTML5 WG
  12. 12. “...extending the language to better support Web applications [...] This puts HTML in direct competition with other technologies[...] , in particular Flash and Silverlight.” Ian Hickson, Editor of HTML5 http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
  13. 13. HTML5 does not replace HTML 4.01 / XHTML 1.0
  14. 14. HTML5 has more bling!
  15. 15. HTML5 specification for browser developers (how to interpret markup/code – no more reverse engineering) for authors: HTML5 differences from HTML4 http://www.w3.org/TR/html5-diff/
  16. 16. 1. syntax/semantic 2. forms 3. multimedia
  17. 17. 1. syntax/semantic 2. forms 3. multimedia
  18. 18. HTML5 standardises current browser behaviour (e.g. “relaxed” coding rules)
  19. 19. the dirty secret of the doctype
  20. 20. XHTML 1.0<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  21. 21. HTML5 <!DOCTYPE html>
  22. 22. <meta charset=”utf-8” /> <meta charset=utf-8> <MeTa CHarSet=utf-8>
  23. 23. <style type=”text/css”> </style> <script type=”text/javascript”> </script>
  24. 24. <style type=”text/css”> </style> <script type=”text/javascript”> </script>
  25. 25. <!doctype html> <title>Minimal HTML5</title>
  26. 26. new elemente for more accurate semantics
  27. 27. Top 20 class names 1. 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
  28. 28. Top 20 id names 1. 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
  29. 29. unambiguous and machine readable ...e.g. screenreaders?
  30. 30. new and old browsers “support” these (although some need a little extra help) header, footer, … { display: block; }
  31. 31. Internet Explorer <9 needs extra training wheels document.createElement('header'); document.createElement('footer'); … http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2
  32. 32. 1. syntax/semantics 2. forms 3. multimedia
  33. 33. improved form elements because the web is more interactive
  34. 34. jqueryui.com
  35. 35. rich form elements – without faking them in JS <input type=”date”> <input type=”time”> <input type=”month”> <input type=”week”> <input type=”datetime” … > <input type=”range”> <input type=”number”> <input type=”file” multiple> <input … autofocus> <input … autocomplete>
  36. 36. types und attributes with built-in validation <input … required> <input type=”tel”> <input type=”email”> <input type=”url”> <input … pattern="[a-z]{3}[0-9]{3}">
  37. 37. 1. syntax/semantics 2. forms 3. multimedia
  38. 38. making your site Fonzie compliant...
  39. 39. <video>
  40. 40. Adobe Flash currently most common video delivery mechanism
  41. 41. <object width="425" height="344"> <param name="movie" value="http://www.youtube.com/v/9sEI1AUFJKw&hl=en &fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/9sEI1AUFJKw&hl=en&f s=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object>
  42. 42. <video src="video.webm" controls autoplay loop preload poster="poster.jpg" width="320" height="240"> <a href="video.webm">Download movie</a> </video>
  43. 43. video as native object ● behaves like any other HTML element ● keyboard accessibility out-of-the-box
  44. 44. powerful (simple) API
  45. 45. www.w3.org/TR/html5/video.html#media-elements
  46. 46. controlling <video> with JavaScript var v = document.getElementById('player'); v.play(); v.pause(); v.volume = … ; v.currentTime = … ; …
  47. 47. events fired by <video> var v = document.getElementById('player'); v.addEventListener('loadeddata', function() { … }, true) v.addEventListener('play', function() { … }, true) v.addEventListener('pause', function() { … }, true) v.addEventListener('timeupdate', function() { … }, true) v.addEventListener('ended', function() { … }, true) …
  48. 48. video formats the big debate?
  49. 49. HTML5 does not specify video container/codec (same as with images in HTML 4?)
  50. 50. MP4 / H.264 ubiquitous, patent encumbered, licensing/royalties
  51. 51. Ogg Theora free and open, no licensing fees not many tools for it, not web optimised
  52. 52. WebM / VP8 open and royalty-free, web-optimised support by hardware and software vendors
  53. 53. providing multiple sources <video controls autoplay poster="…" width="…" height="…"> <source src="movie.mp4" type="video/mp4" /> <source src="movie.webm" type="video/webm" /> <source src="movie.ogv" type="video/ogg" /> <!-- fallback content --> </video>
  54. 54. flash fallback for older browsers http://camendesign.com/code/video_for_everybody
  55. 55. <video controls autoplay poster="…" width="…" height="…"> <source src="movie.mp4" type="video/mp4" /> <source src="movie.webm" type="video/webm" /> <source src="movie.ogv" type="video/ogg" /> <object width="…" height="…" type="application/x- shockwave-flash" data="player.swf"> <param name="movie" value="player.swf" /> <param name="flashvars" value=" … file=movie.mp4" /> <!-- fallback content --> </object> </video>
  56. 56. <audio>
  57. 57. audio...exactly the same as video <audio src=”music.mp3” controls autoplay … ></audio> <audio controls autoplay> <source src="music.mp3" type="audio/mpeg" /> <source src="music.oga" type="audio/ogg" /> <!-- fallback content --> </audio> formats: MP3 vs Ogg Vorbis (vs WAV)
  58. 58. <canvas>
  59. 59. canvas = “scriptable images” <canvas width="…" height="…"></canvas>
  60. 60. canvas has standard API methods for drawing ctx = canvas.getContext("2d"); ctx.fillRect(x, y, width, height); ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y); ctx.bezierCurveTo(x1, y1, x2, y2, c1, c2); ctx.drawImage(…);
  61. 61. canvas accessibility?
  62. 62. video, audio and canvas on all devices without plugins (Java / Flash / Silverlight not ubiquitous)
  63. 63. HTML5 (and friends) has lots more APIs for developers (for powerful client-side apps)
  64. 64. isgeolocationpartofhtml5.com
  65. 65. geolocation navigator.geolocation.getCurrentPosition(success, error); navigator.geolocation.watchCurrentPosition(success, error); function success(position) { /* where's Wally? */ var lat = position.coords.latitude; var long = position.coords.longitude; ... }
  66. 66. offline detection... window.addEventListener('online', function(){ … }, true); window.addEventListener('offline', function(){ … }, true); and application cache <html manifest=”blah.manifest”> CACHE MANIFEST # send this with correct text/cache-manifest MIME images/sprites.png scripts/common.js scripts/jquery.js styles/global.css data.xml and much more...
  67. 67. is it all safe to use, right now?
  68. 68. www.youtube.com/html5
  69. 69. don't do browser sniffing http://www.flickr.com/photos/timdorr/2096272747/
  70. 70. feature-detection progressive enhancement, graceful degradation http://diveintohtml5.org/everything.html
  71. 71. feature-detection for audio/video if (!!document.createElement('video').canPlayType;) { … } if (!!document.createElement('audio').canPlayType;) { … }
  72. 72. patching older browsers github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
  73. 73. sublimevideo.net
  74. 74. videojs.com
  75. 75. www.happyworm.com/jquery/jplayer
  76. 76. HTML5 as Flashkiller?
  77. 77. not a question of HTML5 replacing Flash...
  78. 78. giving developers a choice!
  79. 79. ...should I use HTML5 today?
  80. 80. “The future is already here – it's just not very evenly distributed” William Gibson
  81. 81. www.opera.com/developer people.opera.com/patrickl/presentations/webtech_09.11.2010/webtech_09.11.2010.pdf patrick.lauke@opera.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×