SlideShare una empresa de Scribd logo
1 de 58
HTML 5 A probably not so complete introduction
The Disclaimer I’m not an expert… So… Feel free to share your expertise! Most of this presentation is a synopsis of the excellent book Dive into HTML5 by Mark Pilgrim. An online version of the text can be found at http://diveintohtml5.org/. Legal and everything!
A bit of motivation “HTML was primarily designed as a language for semantically describing scientific documents, although its general design and adaptations over the years have enabled it to be used to describe a number of other types of documents. The main area that has not been adequately addressed by HTML is a vague subject referred to as Web Applications. This specification attempts to rectify this, while at the same time updating the HTML specifications to address issues raised in the past few years.” from the HTML5 Working Draft (19 October 2010)
Can I use it today? Detect browser support using Javascript. Modernizr can help you out for this. The Modernizr homepage will show a feature grid for the current browser. Check out your favorite browser at http://www.modernizr.com/.
So can I use it today… on the desktop? Your mileage may vary… This should improve with the release of IE9.
So can I use it today… on mobiles? Looking good!
The topics we’ll cover More and less markup Drawing things Showing videos Geolocation Offline storage The offline application cache Microdata
The topics we won’t cover CSS3 New form elements Web Sockets Web Workers Web SQL Database And many more!
Learn by example We’ll dissect an example as we go along. It will showcase every featured topic. It’s a poor man’s mobile application. Leverage superior support on mobile platforms. (I’m hoping to become a mobile developer someday.)
Let’s get started!
More and less markup (I) A new and simple doctype: <!DOCTYPE html PUBLIC  	"-//W3C//DTD XHTML 1.0 Strict//EN“ 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-	strict.dtd"> <!DOCTYPE html>
More and less markup (II) A new and simple root element: <html xmlns="http://www.w3.org/1999/xhtml"  lang="en" xml:lang="en"> <html lang="en">
More and less markup (III) New and simple character encoding selection:  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta charset="utf-8" />
More and less markup (IV) Slightly more simple stylesheets: <link rel="stylesheet" href="style-original.css" type="text/css" /> <link rel="stylesheet" href="style-original.css" />
More and less markup (V) New link types: nofollow, prefetch, ...
More and less markup (VI) New semantic elements: <section>, <nav>, <article>, <aside>, <hgroup>, <header>, <footer>, <time>, <mark>, ... Be wary: Weirdness may happen when the browser doesn't (yet) recognize these elements!
Drawing things (I) “The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, or other visual images on the fly.” from the HTML5 Working Draft (19 October 2010)
Drawing things (II) Use the <canvas> element to insert a canvas: <canvas id="myCanvas" width="300" height="225"/>
Drawing things (III) Get access to the drawing context via Javascript: var myCanvas = document.getElementById("myCanvas"); var myContext = myCanvas.getContext("2d");
Drawing things (IV) Draw some rectangles: myContext.fillStyle = "rgb(43, 62, 199)"; myContext.fillRect(0, 0, 300, 225); myContext.lineWidth = 5; myContext.strokeStyle = "black"; myContext.strokeRect(0, 0, 300, 225);
Drawing things (V) Draw some paths: myContext.beginPath(); myContext.moveTo(50, 112); myContext.lineTo(240, 112); myContext.stroke(); myContext.beginPath(); myContext.moveTo(250, 112); myContext.lineTo(220, 82); myContext.lineTo(220, 142); myContext.closePath(); myContext.fill();
Drawing things (VI) Draw some text: myContext.font = "bold 12px sans-serif"; myContext.fillText("<canvas> is sweet!", 40, 50);
Drawing things (VII) Handle some click events: function handleClick(clickEvent)  {     var x, y;     if ( clickEvent.pageX != undefined && clickEvent.pageY != undefined )    {        x = clickEvent.pageX;        y = clickEvent.pageY;    }    else    {        x = clickEvent.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;        y = clickEvent.clientY + document.body.scrollTop + document.documentElement.scrollTop;    }     x -= myCanvas.offsetLeft;    y -= myCanvas.offsetTop;     // You should probably do something useful here. } myCanvas.addEventListener("click", handleClick, false);
Drawing things (VIII) Internet Explorer 8 doesn't support canvas. It does support drawing via the Vector Markup Language (VML). The explorercanvas library implements canvas using VML. It does have some limitations. Find it at http://code.google.com/p/explorercanvas/
Showing videos (I) “A video element is used for playing videos or movies.” from the HTML5 Working Draft (19 October 2010)
Showing videos (II) Inserting a video should be as easy as inserting an image: Browsers should have built-in support for playing video. No third-party plugins should be required. Standard formats should exist that are supported by all browsers. But...
Showing videos (III) Surprizingly, no standard formats exist that are supported by all browsers. For maximum compatibility you will have to supply content in multiple formats. HTML 5 will let you specify multiple files in different formats and have the browser select one it supports.
Showing videos (IV) Use the <video> element to insert a video: <video src="movies/alikeforlife.mp4" width="480" height="272" controls />
Showing videos (V) Provide multiple formats: <video width="480" height="272" controls> <source src="alikeforlife.mp4" type='video/mp4;codecs="avc1.42E01E,mp4a.40.2"' /> <source src="alikeforlife.ogv"  type='video/ogg; codecs="theora, vorbis"' /> </video>
Showing videos (VI) Compliant browsers ignore non-<source> children of <video> elements. A nested <object>tag can be included for backwards compatibility. Programmatic control is possible via Javascript.
Geolocation (I) “The Geolocation API defines a high-level interface to location information associated only with the device hosting the implementation, such as latitude and longitude.” from the Geolocation API Candidate Recommendation (7 September 2010)
Geolocation (II) Request the current position: function callback(position) {     var timestamp = position.timestamp;    var latitude = position.coords.latitude;     var longitude = position.coords.longitude;     // ... } navigator.geolocation.getCurrentPosition(callback);
Geolocation (III) The position is returned asynchronously. Location information can come from a number of sources. A GPS unit is not necessarily required. “User agents must not send location information to Web sites without the express permission of the user.” Usually a popup will explicitly ask for permission.
Geolocation (IV) Do some error handling: function errorHandler(error) { var code = error.code;    var message = error.message;     // ... } navigator.geolocation.getCurrentPosition(callback,        errorHandler);
Geolocation (V) Set some options: var options =  {     enableHighAccuracy: true,    timeout: 10000,    maximumAge: 60000 } navigator.geolocation.getCurrentPosition(callback,        errorHandler, options);
Geolocation (VI) Do some continuous tracking: var ticket = navigator.geolocation.watchPosition(         callback, errorHandler, options); navigator.geolocation.clearWatch(ticket);
Geolocation (VII) You may want to support additional geolocation frameworks: Gears Blackberry Nokia ... The geo-location-javascript library provides a unified geolocation interface. Find it at http://code.google.com/p/geo-location-javascript/.
Offline storage (I) “This specification defines an API for persistent data storage of key-value pair data in Web clients.” from the Web Storage Working Draft (22 December 2009)
Offline storage (II) Load and store data via the localStorage object: localStorage.setItem("someProperty", "someValue"); var value = localStorage.getItem("someProperty");
Offline storage (III) You may prefer associative arrays: localStorage["someProperty"] = "someValue"; var value = localStorage["someProperty"];
Offline storage (IV) Store information as key/value pairs. Values are stored as strings. You'll have to coerce the value to the proper type if it's not a string. Everything happens client-side. Unlike cookies, no data is sent to the server. It's even supported in Internet Explorer 8!
Offline storage (V) The specification suggests an arbitrary limit of 5 megabytes per origin. Storage is per domain. Cross-directory attacks are possible on shared hosts!
The offline application cache (I) “In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable (...) authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the user's browser to keep a copy of the files for use offline.” from the HTML5 Working Draft (19 October 2010)
The offline application cache (II) Enable offline use of your web-application: All application resources are downloaded into an offline cache when the user visits your webpage. The page can then be served from the cache, even when the user is offline.
The offline application cache (III) A manifest lists the resources of your application: CACHE MANIFEST # Revision 99 images/logo.jpg index.php stylesheet.css
The offline application cache (IV) You reference the manifest from every HTML file: <html manifest="/cache.manifest"> <!–– ... ––> </html>
The offline application cache (V) The manifest is checked on every page visit. When the manifest has changed, the resources are recached. This process is automatic. Javascript events allow you to know what's going on.
The offline application cache (VI) You can have three sections in your manifest: A cache section. Required resources to be stored in the cache. A network section. Uncached resources that will only be referenced when online. A fallback section. Resources matching these URL patterns will be satisfied via the network when online, or will be mapped on the specified resource when offline.
The offline application cache (VII) The manifest file must be served with the text/cache-manifestcontent-type. Only resources listed in the manifest can be accessed, even when online. The offline cache will only be updated when the manifest file itself changes. Adding a revision count to your manifest is a good idea. When a new version of your page is cached it will take an additional reload of the page to switch to the new cache.
Microdata (I) “This mechanism allows machine-readable data to be embedded in HTML documents in an easy-to-write manner, with an unambiguous parsing model.” from the HTML Microdata Working Draft (19 October 2010)
Microdata (II) Add custom-domain semantic information to your HTML markup. Make it so that a machine can interpret the information on your webpage within the specified domain.
Microdata (III) The semantic domain of HTML is constrained to documents. It lets you describe such things as sections, headers, paragraphs, etc. Via microdata you can add semantic meaning to a specific tag. The content of a specific <span> tag might for instance be the name of a person.
Microdata (IV) A vocabulary defines: A specific semantic object, f.i. a Person. A number of properties that this semantic object can have, f.i. a name or an email address. A vocabulary is identified by means of a URI.
Microdata (V) How it might look in your HTML code: <section itemscope      itemtype="http://data-vocabulary.org/Person">   <h1>Contact Information</h1>   <dl>     <dt>Name</dt>     <dd itemprop="name">John Doe</dd>   </dl>	 </section>
Microdata (VI) Google's spider interprets microdata. Annotated pages will appear semantically formatted in search results.
Questions?
Thanks!
References ,[object Object]

Más contenido relacionado

La actualidad más candente

Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally ChohanHtml 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohanballychohanuk
 
Michael(tm) Smith: HTML5 at Web Directions South 2008
Michael(tm) Smith: HTML5 at Web Directions South 2008Michael(tm) Smith: HTML5 at Web Directions South 2008
Michael(tm) Smith: HTML5 at Web Directions South 2008Michael(tm) Smith
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 BoilerplateMichael Enslow
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and ResourcesRon Reiter
 
Droidcon London 2021 - Full Stack Dart
Droidcon London 2021   - Full Stack DartDroidcon London 2021   - Full Stack Dart
Droidcon London 2021 - Full Stack DartChris Swan
 
Html 5 New Features
Html 5 New FeaturesHtml 5 New Features
Html 5 New FeaturesAta Ebrahimi
 
HTML5 and Search Engine Optimization (SEO)
HTML5 and Search Engine Optimization (SEO)HTML5 and Search Engine Optimization (SEO)
HTML5 and Search Engine Optimization (SEO)Performics.Convonix
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedMinded Security
 
Pragmatics of Declarative Ajax
Pragmatics of Declarative AjaxPragmatics of Declarative Ajax
Pragmatics of Declarative Ajaxdavejohnson
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginnersSingsys Pte Ltd
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practicesYoni Goldberg
 
An Introduction to HTML5
An Introduction to HTML5An Introduction to HTML5
An Introduction to HTML5Steven Chipman
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5Sayed Ahmed
 
Introdution to HTML 5
Introdution to HTML 5Introdution to HTML 5
Introdution to HTML 5onkar_bhosle
 

La actualidad más candente (20)

Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
Html 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally ChohanHtml 5 tutorial - By Bally Chohan
Html 5 tutorial - By Bally Chohan
 
Think jQuery
Think jQueryThink jQuery
Think jQuery
 
Michael(tm) Smith: HTML5 at Web Directions South 2008
Michael(tm) Smith: HTML5 at Web Directions South 2008Michael(tm) Smith: HTML5 at Web Directions South 2008
Michael(tm) Smith: HTML5 at Web Directions South 2008
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and Resources
 
Droidcon London 2021 - Full Stack Dart
Droidcon London 2021   - Full Stack DartDroidcon London 2021   - Full Stack Dart
Droidcon London 2021 - Full Stack Dart
 
Html 5 New Features
Html 5 New FeaturesHtml 5 New Features
Html 5 New Features
 
HTML5 and Search Engine Optimization (SEO)
HTML5 and Search Engine Optimization (SEO)HTML5 and Search Engine Optimization (SEO)
HTML5 and Search Engine Optimization (SEO)
 
Up to Speed on HTML 5 and CSS 3
Up to Speed on HTML 5 and CSS 3Up to Speed on HTML 5 and CSS 3
Up to Speed on HTML 5 and CSS 3
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession Learned
 
Pragmatics of Declarative Ajax
Pragmatics of Declarative AjaxPragmatics of Declarative Ajax
Pragmatics of Declarative Ajax
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
 
An Introduction to HTML5
An Introduction to HTML5An Introduction to HTML5
An Introduction to HTML5
 
Introduction to html 5
Introduction to html 5Introduction to html 5
Introduction to html 5
 
Introdution to HTML 5
Introdution to HTML 5Introdution to HTML 5
Introdution to HTML 5
 
GWT widget development
GWT widget developmentGWT widget development
GWT widget development
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 

Destacado

Prioritization Survey Results
Prioritization Survey ResultsPrioritization Survey Results
Prioritization Survey ResultsMichal Bularz
 
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar prosesIrma Muthiara Sari
 
Puntuaciones iniciales (Domingo 23 a las 22:00h)
Puntuaciones iniciales (Domingo 23 a las 22:00h)Puntuaciones iniciales (Domingo 23 a las 22:00h)
Puntuaciones iniciales (Domingo 23 a las 22:00h)Emi Voces
 
Puntuaciones provisionales (martes 25 a las 12h)
Puntuaciones provisionales (martes 25 a las 12h)Puntuaciones provisionales (martes 25 a las 12h)
Puntuaciones provisionales (martes 25 a las 12h)Emi Voces
 
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)有評有具--講評3部曲之首部曲(作大夢的歐吉桑)
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)Alan Huang
 
在Aix6.1上安装11g r2 rac grid infrastructure集群
在Aix6.1上安装11g r2 rac grid infrastructure集群在Aix6.1上安装11g r2 rac grid infrastructure集群
在Aix6.1上安装11g r2 rac grid infrastructure集群maclean liu
 
Solsticio de inverno
Solsticio de invernoSolsticio de inverno
Solsticio de invernofatimaamboage
 
Permen tahun2013 nomor81a_lampiran4
Permen tahun2013 nomor81a_lampiran4Permen tahun2013 nomor81a_lampiran4
Permen tahun2013 nomor81a_lampiran4Irma Muthiara Sari
 
Computer powerpoint
Computer powerpointComputer powerpoint
Computer powerpointtoppins76
 
New Zealand Franchising Confidence Index | January 2014
New Zealand Franchising Confidence Index | January 2014New Zealand Franchising Confidence Index | January 2014
New Zealand Franchising Confidence Index | January 2014Franchize Consultants
 
Oracle services on rac
Oracle services on racOracle services on rac
Oracle services on racmaclean liu
 
Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具maclean liu
 
The Military Medical Community Within NATO and its Multinational Challenges- ...
The Military Medical Community Within NATO and its Multinational Challenges- ...The Military Medical Community Within NATO and its Multinational Challenges- ...
The Military Medical Community Within NATO and its Multinational Challenges- ...Leishman Associates
 
Global Magazine, Spring 2011
Global Magazine, Spring 2011Global Magazine, Spring 2011
Global Magazine, Spring 2011Eleonor Fedorey
 
What if I can design my care?
What if I can design my care?What if I can design my care?
What if I can design my care?Stefania Marcoli
 
Enablement Main
Enablement MainEnablement Main
Enablement Mainjonanrp
 

Destacado (20)

Forum del turismo
Forum del turismoForum del turismo
Forum del turismo
 
Prioritization Survey Results
Prioritization Survey ResultsPrioritization Survey Results
Prioritization Survey Results
 
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
 
Puntuaciones iniciales (Domingo 23 a las 22:00h)
Puntuaciones iniciales (Domingo 23 a las 22:00h)Puntuaciones iniciales (Domingo 23 a las 22:00h)
Puntuaciones iniciales (Domingo 23 a las 22:00h)
 
Puntuaciones provisionales (martes 25 a las 12h)
Puntuaciones provisionales (martes 25 a las 12h)Puntuaciones provisionales (martes 25 a las 12h)
Puntuaciones provisionales (martes 25 a las 12h)
 
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)有評有具--講評3部曲之首部曲(作大夢的歐吉桑)
有評有具--講評3部曲之首部曲(作大夢的歐吉桑)
 
在Aix6.1上安装11g r2 rac grid infrastructure集群
在Aix6.1上安装11g r2 rac grid infrastructure集群在Aix6.1上安装11g r2 rac grid infrastructure集群
在Aix6.1上安装11g r2 rac grid infrastructure集群
 
Solsticio de inverno
Solsticio de invernoSolsticio de inverno
Solsticio de inverno
 
Permen tahun2013 nomor81a_lampiran4
Permen tahun2013 nomor81a_lampiran4Permen tahun2013 nomor81a_lampiran4
Permen tahun2013 nomor81a_lampiran4
 
Computer powerpoint
Computer powerpointComputer powerpoint
Computer powerpoint
 
New Zealand Franchising Confidence Index | January 2014
New Zealand Franchising Confidence Index | January 2014New Zealand Franchising Confidence Index | January 2014
New Zealand Franchising Confidence Index | January 2014
 
Oracle services on rac
Oracle services on racOracle services on rac
Oracle services on rac
 
Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具Prm 一个oracle数据库灾难恢复救护车工具
Prm 一个oracle数据库灾难恢复救护车工具
 
Bugie per non offendere
Bugie per non offendereBugie per non offendere
Bugie per non offendere
 
The Military Medical Community Within NATO and its Multinational Challenges- ...
The Military Medical Community Within NATO and its Multinational Challenges- ...The Military Medical Community Within NATO and its Multinational Challenges- ...
The Military Medical Community Within NATO and its Multinational Challenges- ...
 
4 sesons
4 sesons4 sesons
4 sesons
 
Global Magazine, Spring 2011
Global Magazine, Spring 2011Global Magazine, Spring 2011
Global Magazine, Spring 2011
 
What if I can design my care?
What if I can design my care?What if I can design my care?
What if I can design my care?
 
Assalamualaikum PROSA
Assalamualaikum PROSAAssalamualaikum PROSA
Assalamualaikum PROSA
 
Enablement Main
Enablement MainEnablement Main
Enablement Main
 

Similar a HTML5 Introduction

Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersTodd Anglin
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshellLennart Schoors
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentTilak Joshi
 
HTML5 - Future of Web
HTML5 - Future of WebHTML5 - Future of Web
HTML5 - Future of WebMirza Asif
 
Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010Patrick Lauke
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesOry Segal
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5Ravi Raj
 
Thadomal IEEE-HTML5-Workshop
Thadomal IEEE-HTML5-WorkshopThadomal IEEE-HTML5-Workshop
Thadomal IEEE-HTML5-WorkshopRomin Irani
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQueryDanWooster1
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologiesgeorge.james
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008Association Paris-Web
 

Similar a HTML5 Introduction (20)

Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
 
HTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web DevelopmentHTML5: An Introduction To Next Generation Web Development
HTML5: An Introduction To Next Generation Web Development
 
HTML5 - Future of Web
HTML5 - Future of WebHTML5 - Future of Web
HTML5 - Future of Web
 
Shifting Gears
Shifting GearsShifting Gears
Shifting Gears
 
Html5
Html5Html5
Html5
 
Speak the Web 15.02.2010
Speak the Web 15.02.2010Speak the Web 15.02.2010
Speak the Web 15.02.2010
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
HTML 5
HTML 5HTML 5
HTML 5
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
 
HTML 5
HTML 5HTML 5
HTML 5
 
Introduction to html5
Introduction to html5Introduction to html5
Introduction to html5
 
HTML5와 모바일
HTML5와 모바일HTML5와 모바일
HTML5와 모바일
 
Thadomal IEEE-HTML5-Workshop
Thadomal IEEE-HTML5-WorkshopThadomal IEEE-HTML5-Workshop
Thadomal IEEE-HTML5-Workshop
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
WP - Unit I.ppt
WP - Unit I.pptWP - Unit I.ppt
WP - Unit I.ppt
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQuery
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
 
HTML 5 - Overview
HTML 5 - OverviewHTML 5 - Overview
HTML 5 - Overview
 

Último

Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Último (20)

Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

HTML5 Introduction

  • 1. HTML 5 A probably not so complete introduction
  • 2. The Disclaimer I’m not an expert… So… Feel free to share your expertise! Most of this presentation is a synopsis of the excellent book Dive into HTML5 by Mark Pilgrim. An online version of the text can be found at http://diveintohtml5.org/. Legal and everything!
  • 3. A bit of motivation “HTML was primarily designed as a language for semantically describing scientific documents, although its general design and adaptations over the years have enabled it to be used to describe a number of other types of documents. The main area that has not been adequately addressed by HTML is a vague subject referred to as Web Applications. This specification attempts to rectify this, while at the same time updating the HTML specifications to address issues raised in the past few years.” from the HTML5 Working Draft (19 October 2010)
  • 4. Can I use it today? Detect browser support using Javascript. Modernizr can help you out for this. The Modernizr homepage will show a feature grid for the current browser. Check out your favorite browser at http://www.modernizr.com/.
  • 5. So can I use it today… on the desktop? Your mileage may vary… This should improve with the release of IE9.
  • 6. So can I use it today… on mobiles? Looking good!
  • 7. The topics we’ll cover More and less markup Drawing things Showing videos Geolocation Offline storage The offline application cache Microdata
  • 8. The topics we won’t cover CSS3 New form elements Web Sockets Web Workers Web SQL Database And many more!
  • 9. Learn by example We’ll dissect an example as we go along. It will showcase every featured topic. It’s a poor man’s mobile application. Leverage superior support on mobile platforms. (I’m hoping to become a mobile developer someday.)
  • 11. More and less markup (I) A new and simple doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"> <!DOCTYPE html>
  • 12. More and less markup (II) A new and simple root element: <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html lang="en">
  • 13. More and less markup (III) New and simple character encoding selection: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta charset="utf-8" />
  • 14. More and less markup (IV) Slightly more simple stylesheets: <link rel="stylesheet" href="style-original.css" type="text/css" /> <link rel="stylesheet" href="style-original.css" />
  • 15. More and less markup (V) New link types: nofollow, prefetch, ...
  • 16. More and less markup (VI) New semantic elements: <section>, <nav>, <article>, <aside>, <hgroup>, <header>, <footer>, <time>, <mark>, ... Be wary: Weirdness may happen when the browser doesn't (yet) recognize these elements!
  • 17. Drawing things (I) “The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, or other visual images on the fly.” from the HTML5 Working Draft (19 October 2010)
  • 18. Drawing things (II) Use the <canvas> element to insert a canvas: <canvas id="myCanvas" width="300" height="225"/>
  • 19. Drawing things (III) Get access to the drawing context via Javascript: var myCanvas = document.getElementById("myCanvas"); var myContext = myCanvas.getContext("2d");
  • 20. Drawing things (IV) Draw some rectangles: myContext.fillStyle = "rgb(43, 62, 199)"; myContext.fillRect(0, 0, 300, 225); myContext.lineWidth = 5; myContext.strokeStyle = "black"; myContext.strokeRect(0, 0, 300, 225);
  • 21. Drawing things (V) Draw some paths: myContext.beginPath(); myContext.moveTo(50, 112); myContext.lineTo(240, 112); myContext.stroke(); myContext.beginPath(); myContext.moveTo(250, 112); myContext.lineTo(220, 82); myContext.lineTo(220, 142); myContext.closePath(); myContext.fill();
  • 22. Drawing things (VI) Draw some text: myContext.font = "bold 12px sans-serif"; myContext.fillText("<canvas> is sweet!", 40, 50);
  • 23. Drawing things (VII) Handle some click events: function handleClick(clickEvent) { var x, y; if ( clickEvent.pageX != undefined && clickEvent.pageY != undefined ) { x = clickEvent.pageX; y = clickEvent.pageY; } else { x = clickEvent.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; y = clickEvent.clientY + document.body.scrollTop + document.documentElement.scrollTop; } x -= myCanvas.offsetLeft; y -= myCanvas.offsetTop; // You should probably do something useful here. } myCanvas.addEventListener("click", handleClick, false);
  • 24. Drawing things (VIII) Internet Explorer 8 doesn't support canvas. It does support drawing via the Vector Markup Language (VML). The explorercanvas library implements canvas using VML. It does have some limitations. Find it at http://code.google.com/p/explorercanvas/
  • 25. Showing videos (I) “A video element is used for playing videos or movies.” from the HTML5 Working Draft (19 October 2010)
  • 26. Showing videos (II) Inserting a video should be as easy as inserting an image: Browsers should have built-in support for playing video. No third-party plugins should be required. Standard formats should exist that are supported by all browsers. But...
  • 27. Showing videos (III) Surprizingly, no standard formats exist that are supported by all browsers. For maximum compatibility you will have to supply content in multiple formats. HTML 5 will let you specify multiple files in different formats and have the browser select one it supports.
  • 28. Showing videos (IV) Use the <video> element to insert a video: <video src="movies/alikeforlife.mp4" width="480" height="272" controls />
  • 29. Showing videos (V) Provide multiple formats: <video width="480" height="272" controls> <source src="alikeforlife.mp4" type='video/mp4;codecs="avc1.42E01E,mp4a.40.2"' /> <source src="alikeforlife.ogv" type='video/ogg; codecs="theora, vorbis"' /> </video>
  • 30. Showing videos (VI) Compliant browsers ignore non-<source> children of <video> elements. A nested <object>tag can be included for backwards compatibility. Programmatic control is possible via Javascript.
  • 31. Geolocation (I) “The Geolocation API defines a high-level interface to location information associated only with the device hosting the implementation, such as latitude and longitude.” from the Geolocation API Candidate Recommendation (7 September 2010)
  • 32. Geolocation (II) Request the current position: function callback(position) { var timestamp = position.timestamp; var latitude = position.coords.latitude; var longitude = position.coords.longitude; // ... } navigator.geolocation.getCurrentPosition(callback);
  • 33. Geolocation (III) The position is returned asynchronously. Location information can come from a number of sources. A GPS unit is not necessarily required. “User agents must not send location information to Web sites without the express permission of the user.” Usually a popup will explicitly ask for permission.
  • 34. Geolocation (IV) Do some error handling: function errorHandler(error) { var code = error.code; var message = error.message; // ... } navigator.geolocation.getCurrentPosition(callback, errorHandler);
  • 35. Geolocation (V) Set some options: var options = { enableHighAccuracy: true, timeout: 10000, maximumAge: 60000 } navigator.geolocation.getCurrentPosition(callback, errorHandler, options);
  • 36. Geolocation (VI) Do some continuous tracking: var ticket = navigator.geolocation.watchPosition( callback, errorHandler, options); navigator.geolocation.clearWatch(ticket);
  • 37. Geolocation (VII) You may want to support additional geolocation frameworks: Gears Blackberry Nokia ... The geo-location-javascript library provides a unified geolocation interface. Find it at http://code.google.com/p/geo-location-javascript/.
  • 38. Offline storage (I) “This specification defines an API for persistent data storage of key-value pair data in Web clients.” from the Web Storage Working Draft (22 December 2009)
  • 39. Offline storage (II) Load and store data via the localStorage object: localStorage.setItem("someProperty", "someValue"); var value = localStorage.getItem("someProperty");
  • 40. Offline storage (III) You may prefer associative arrays: localStorage["someProperty"] = "someValue"; var value = localStorage["someProperty"];
  • 41. Offline storage (IV) Store information as key/value pairs. Values are stored as strings. You'll have to coerce the value to the proper type if it's not a string. Everything happens client-side. Unlike cookies, no data is sent to the server. It's even supported in Internet Explorer 8!
  • 42. Offline storage (V) The specification suggests an arbitrary limit of 5 megabytes per origin. Storage is per domain. Cross-directory attacks are possible on shared hosts!
  • 43. The offline application cache (I) “In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable (...) authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the user's browser to keep a copy of the files for use offline.” from the HTML5 Working Draft (19 October 2010)
  • 44. The offline application cache (II) Enable offline use of your web-application: All application resources are downloaded into an offline cache when the user visits your webpage. The page can then be served from the cache, even when the user is offline.
  • 45. The offline application cache (III) A manifest lists the resources of your application: CACHE MANIFEST # Revision 99 images/logo.jpg index.php stylesheet.css
  • 46. The offline application cache (IV) You reference the manifest from every HTML file: <html manifest="/cache.manifest"> <!–– ... ––> </html>
  • 47. The offline application cache (V) The manifest is checked on every page visit. When the manifest has changed, the resources are recached. This process is automatic. Javascript events allow you to know what's going on.
  • 48. The offline application cache (VI) You can have three sections in your manifest: A cache section. Required resources to be stored in the cache. A network section. Uncached resources that will only be referenced when online. A fallback section. Resources matching these URL patterns will be satisfied via the network when online, or will be mapped on the specified resource when offline.
  • 49. The offline application cache (VII) The manifest file must be served with the text/cache-manifestcontent-type. Only resources listed in the manifest can be accessed, even when online. The offline cache will only be updated when the manifest file itself changes. Adding a revision count to your manifest is a good idea. When a new version of your page is cached it will take an additional reload of the page to switch to the new cache.
  • 50. Microdata (I) “This mechanism allows machine-readable data to be embedded in HTML documents in an easy-to-write manner, with an unambiguous parsing model.” from the HTML Microdata Working Draft (19 October 2010)
  • 51. Microdata (II) Add custom-domain semantic information to your HTML markup. Make it so that a machine can interpret the information on your webpage within the specified domain.
  • 52. Microdata (III) The semantic domain of HTML is constrained to documents. It lets you describe such things as sections, headers, paragraphs, etc. Via microdata you can add semantic meaning to a specific tag. The content of a specific <span> tag might for instance be the name of a person.
  • 53. Microdata (IV) A vocabulary defines: A specific semantic object, f.i. a Person. A number of properties that this semantic object can have, f.i. a name or an email address. A vocabulary is identified by means of a URI.
  • 54. Microdata (V) How it might look in your HTML code: <section itemscope itemtype="http://data-vocabulary.org/Person"> <h1>Contact Information</h1> <dl> <dt>Name</dt> <dd itemprop="name">John Doe</dd> </dl> </section>
  • 55. Microdata (VI) Google's spider interprets microdata. Annotated pages will appear semantically formatted in search results.
  • 58.
  • 60. The HTML5 Working Draft (19 October 2010)http://www.w3.org/TR/2010/WD-html5-20101019/
  • 61. The Geolocation API Candidate Recommendation (7 September 2010)http://www.w3.org/TR/geolocation-API/
  • 62. The Web Storage Working Draft (22 December 2009)http://www.w3.org/TR/webstorage/
  • 63. The HTML Microdata Working Draft (19 October 2010)http://www.w3.org/TR/microdata/