SlideShare une entreprise Scribd logo
1  sur  26
Practical HTML5
Maurice de Beijer
Who am I?
•
•
•
•
•
•
•
•

Maurice de Beijer
The Problem Solver
Microsoft Integration MVP
DevelopMentor instructor
Twitter:
@mauricedb
Blog:
http://msmvps.com/blogs/theproblemsolver/
Web:
http://www.HTML5Support.nl
E-mail:
mauricedb@develop.com

2
What are we going to cover?
•
•
•
•
•
•

Polyfills
Semantic elements
WebSockets
Drag/Drop
Graphics
Storing data in the browser

• Demos at: http://bit.ly/lph5

3
Polyfills
• Not every browser supports every HTML5 feature
– Especially true with old browsers
• Many missing features can be added using a polyfill
– Offers the standard API
– Often done in JavaScript
– JavaScript is slow in older browsers 
• A few good lists to check
– Modernizr HTML5 Cross Browser Polyfills
– HTML5 please

4
HTML5 Semantic elements
• New HTML5 elements
– <nav>
– <section>
– <header>
– <footer>
– <article>
– <aside>

5
HTML5 Semantic elements
• How about support?

6
HTML5 Semantic elements
• Why use them?
– Searchability
– Accessibility
• Neither really makes sense
– Search engines don’t really care
– Use WAI-ARIA for accessibility support
• Make sure to add support in older versions of IE
– Modernizr
– Html5Shiv

7
HTML5 Semantic elements
• The new HTML5 input elements
– <input type="email"/>
– <input type="number"/>
– <input type="url"/>
– <input type="date"/>
– <input type="datetime"/>
– <input type="month"/>
– <input type="week"/>
– …..
• Support is not very good, only really useful on mobile devices

8
HTML5 Semantic elements
• Other more useful HTML5 elements
– <video>
– <audio>
– <meter>
– <progress>
– <time>

9
WebSockets
• A bi-directional socket connection
– Between a web browser and the web server
• The server can push updates to the browser
– Refreshing the browser to see updates is so 2012 
• Not just for games and chat applications
– Any application where you want fast updates
– Decrease the chance of concurrency issues

10
WebSockets
• How about support?

11
WebSockets
• Suffers from lack of infrastructure support
– Routers and firewalls can cause issues
• The API is low level
– Messages are just simple objects
– You might need to retransmit missed messages
• Use ASP.NET SignalR
– Uses WebSockets if possible
– Otherwise it uses fallbacks like Comet
– Supports scale out scenarios
– Uses a very simple API
• Using Node.js?
– Use Socket.IO instead

12
Drag and Drop
• Drag and drop can be a very intuitive user interaction
– Often seen as more fun by users
• Very common interaction on tablets
– But works equally well with a mouse
• HTML5 supports drag and drop
– Including dragging from the file system

13
Drag and Drop
How about support?

14
Drag and Drop
• Use jQuery UI instead of the HTML5 capabilities
– Use jQuery UI Touch Punch for touch support
– Add -ms-touch-action: none in CSS for Windows 8

15
Graphics
• Rich graphics are common in modern applications
– Interactive graphics
– Charts
• Often generated on the client
– Not just images downloaded from the server
• Two basic options
– Scalable Vector Graphics
– Canvas

16
Comparison of Canvas and SVG
Canvas

SVG

Pixel-based (canvas is essentially an image
element with a drawing API)

Object Model-based (SVG elements are
similar to HTML elements)

Single HTML element similar to <img> in
behavior

Multiple graphical elements which become
part of the Document Object Model (DOM)

Visual presentation created and modified
programmatically through script

Visual presentation created with markup and
modified by CSS or programmatically
through script

Event model/user interaction is coarse—at
the canvas element only; interactions must be
manually programmed from mouse
coordinates
API does not support accessibility; markupbased techniques must be used in addition to
canvas

Event model/user interaction is object-based
at the level of primitive graphic elements—
lines, rectangles, paths
SVG markup and object model directly
supports accessibility

17
SVG
• How about support?

18
Canvas
• How about support?

19
Graphics
• Use a library to make the API easier
– Don’t worry about Canvas versus SVG
• jqPlot is great for charts
– It uses canvas
– Includes exCanvas for IE 7/8 support
• Raphaël is a great choice for general graphics
– It uses SVG
– Uses VML for IE 7/8 support

20
Storing data in the browser

21
IndexedDB
• How about support?

22
LocalStorage
• How about support?

23
Storing data in the browser
• LocalStorage is well supported
– Except in very old versions of IE
• IndexedDB is much more powerful
– But the API is hard to use
• Lawnchair is easy to use
– Abstracts the underlying data storage
– Can use LocalStorage, IndexedDB or other storage
• db.js makes IndexedDB easy to use
– But requires a polyfill in old browsers

24
Conclusion
• There is lots of goodness in HTML5
– But not everything is as useful
• Some of the API’s are hard to use
– But there are good libraries to make things easier
• Think about supporting older browsers
– Use polyfills where needed

25
Questions

?
The presentation and source code will be available
http://msmvps.com/blogs/theproblemsolver/

26

Contenu connexe

Tendances

Bootstrap Presentation Mitesh
Bootstrap Presentation MiteshBootstrap Presentation Mitesh
Bootstrap Presentation Mitesh
Mitesh Gandhi
 
Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 

Tendances (20)

Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016
 
Edy Dawson Notes on SF HTML5 Dev Conf
Edy Dawson Notes on SF HTML5 Dev ConfEdy Dawson Notes on SF HTML5 Dev Conf
Edy Dawson Notes on SF HTML5 Dev Conf
 
Bootstrap Presentation Mitesh
Bootstrap Presentation MiteshBootstrap Presentation Mitesh
Bootstrap Presentation Mitesh
 
Quick Start: Rails
Quick Start: RailsQuick Start: Rails
Quick Start: Rails
 
Quick Application Development with Web Frameworks
Quick Application Development with Web FrameworksQuick Application Development with Web Frameworks
Quick Application Development with Web Frameworks
 
Web Tools report
Web Tools reportWeb Tools report
Web Tools report
 
Single page applications
Single page applicationsSingle page applications
Single page applications
 
Single Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.WebSingle Page Application Development with backbone.js and Simple.Web
Single Page Application Development with backbone.js and Simple.Web
 
A Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMA Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVM
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
 
node.js in action
node.js in actionnode.js in action
node.js in action
 
Building WordPress sites with AngularJS and the RESTful plugin JSON API
Building WordPress sites with AngularJS and the RESTful plugin JSON APIBuilding WordPress sites with AngularJS and the RESTful plugin JSON API
Building WordPress sites with AngularJS and the RESTful plugin JSON API
 
The shift to the edge
The shift to the edgeThe shift to the edge
The shift to the edge
 
Making Single Page Applications (SPA) faster
Making Single Page Applications (SPA) faster Making Single Page Applications (SPA) faster
Making Single Page Applications (SPA) faster
 
Wheel.js
Wheel.jsWheel.js
Wheel.js
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
 
Web Based Development Introduction
Web Based Development IntroductionWeb Based Development Introduction
Web Based Development Introduction
 
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
 
The future of Activiti Cloud @ DevCon 2019
The future of Activiti Cloud @ DevCon 2019The future of Activiti Cloud @ DevCon 2019
The future of Activiti Cloud @ DevCon 2019
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
 

Similaire à Practical HTML5

SlickGrid Touch: Making complex JavaScript widgets work on mobile devices
SlickGrid Touch: Making complex JavaScript widgets work on mobile devicesSlickGrid Touch: Making complex JavaScript widgets work on mobile devices
SlickGrid Touch: Making complex JavaScript widgets work on mobile devices
reebalazs
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
dmethvin
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
Going Mobile with HTML5
Going Mobile with HTML5Going Mobile with HTML5
Going Mobile with HTML5
John Reiser
 
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Jeremy Likness
 

Similaire à Practical HTML5 (20)

Pearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET DeveloperPearls and Must-Have Tools for the Modern Web / .NET Developer
Pearls and Must-Have Tools for the Modern Web / .NET Developer
 
HTML5 features & JavaScript APIs
HTML5 features & JavaScript APIsHTML5 features & JavaScript APIs
HTML5 features & JavaScript APIs
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
Html5 phillycc
Html5 phillyccHtml5 phillycc
Html5 phillycc
 
Bringing HTML5 alive in SharePoint
Bringing HTML5 alive in SharePointBringing HTML5 alive in SharePoint
Bringing HTML5 alive in SharePoint
 
Going mobile with RichFaces
Going mobile with RichFacesGoing mobile with RichFaces
Going mobile with RichFaces
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
 
Developing and deploying a website with html5
Developing and deploying a website with html5Developing and deploying a website with html5
Developing and deploying a website with html5
 
Mobile web development
Mobile web development Mobile web development
Mobile web development
 
SlickGrid Touch: Making complex JavaScript widgets work on mobile devices
SlickGrid Touch: Making complex JavaScript widgets work on mobile devicesSlickGrid Touch: Making complex JavaScript widgets work on mobile devices
SlickGrid Touch: Making complex JavaScript widgets work on mobile devices
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Going Mobile with HTML5
Going Mobile with HTML5Going Mobile with HTML5
Going Mobile with HTML5
 
DIGIT Noe 2016 - Overview of front end development today
DIGIT Noe 2016 - Overview of front end development todayDIGIT Noe 2016 - Overview of front end development today
DIGIT Noe 2016 - Overview of front end development today
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
 
HTML5: the new frontier of the web
HTML5: the new frontier of the webHTML5: the new frontier of the web
HTML5: the new frontier of the web
 

Plus de Maurice De Beijer [MVP]

Plus de Maurice De Beijer [MVP] (20)

Practice TypeScript Techniques Building React Server Components App
Practice TypeScript Techniques Building React Server Components AppPractice TypeScript Techniques Building React Server Components App
Practice TypeScript Techniques Building React Server Components App
 
A foolproof Way to Estimate a Software Project
A foolproof Way to Estimate a Software ProjectA foolproof Way to Estimate a Software Project
A foolproof Way to Estimate a Software Project
 
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
Surati Tech Talks 2022 / Build reliable Svelte applications using CypressSurati Tech Talks 2022 / Build reliable Svelte applications using Cypress
Surati Tech Talks 2022 / Build reliable Svelte applications using Cypress
 
Build reliable Svelte applications using Cypress
Build reliable Svelte applications using CypressBuild reliable Svelte applications using Cypress
Build reliable Svelte applications using Cypress
 
Building Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & AzureBuilding Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & Azure
 
Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18
 
Building reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and AzureBuilding reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and Azure
 
Building large and scalable mission critical applications with React
Building large and scalable mission critical applications with ReactBuilding large and scalable mission critical applications with React
Building large and scalable mission critical applications with React
 
Building Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & AzureBuilding Reliable Applications Using React, .NET & Azure
Building Reliable Applications Using React, .NET & Azure
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
Building reliable web applications using Cypress
Building reliable web applications using CypressBuilding reliable web applications using Cypress
Building reliable web applications using Cypress
 
Getting started with React Suspense and concurrent rendering
Getting started with React Suspense and concurrent renderingGetting started with React Suspense and concurrent rendering
Getting started with React Suspense and concurrent rendering
 
React suspense, not just for Alfred Hitchcock
React suspense, not just for Alfred HitchcockReact suspense, not just for Alfred Hitchcock
React suspense, not just for Alfred Hitchcock
 
From zero to hero with the Reactive extensions for JavaScript
From zero to hero with the Reactive extensions for JavaScriptFrom zero to hero with the Reactive extensions for JavaScript
From zero to hero with the Reactive extensions for JavaScript
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
The new React
The new React The new React
The new React
 
From zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScriptFrom zero to hero with the reactive extensions for JavaScript
From zero to hero with the reactive extensions for JavaScript
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
I am hooked on React
I am hooked on ReactI am hooked on React
I am hooked on React
 
Create flexible React applications using GraphQL apis
Create flexible React applications using GraphQL apisCreate flexible React applications using GraphQL apis
Create flexible React applications using GraphQL apis
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Practical HTML5

  • 2. Who am I? • • • • • • • • Maurice de Beijer The Problem Solver Microsoft Integration MVP DevelopMentor instructor Twitter: @mauricedb Blog: http://msmvps.com/blogs/theproblemsolver/ Web: http://www.HTML5Support.nl E-mail: mauricedb@develop.com 2
  • 3. What are we going to cover? • • • • • • Polyfills Semantic elements WebSockets Drag/Drop Graphics Storing data in the browser • Demos at: http://bit.ly/lph5 3
  • 4. Polyfills • Not every browser supports every HTML5 feature – Especially true with old browsers • Many missing features can be added using a polyfill – Offers the standard API – Often done in JavaScript – JavaScript is slow in older browsers  • A few good lists to check – Modernizr HTML5 Cross Browser Polyfills – HTML5 please 4
  • 5. HTML5 Semantic elements • New HTML5 elements – <nav> – <section> – <header> – <footer> – <article> – <aside> 5
  • 6. HTML5 Semantic elements • How about support? 6
  • 7. HTML5 Semantic elements • Why use them? – Searchability – Accessibility • Neither really makes sense – Search engines don’t really care – Use WAI-ARIA for accessibility support • Make sure to add support in older versions of IE – Modernizr – Html5Shiv 7
  • 8. HTML5 Semantic elements • The new HTML5 input elements – <input type="email"/> – <input type="number"/> – <input type="url"/> – <input type="date"/> – <input type="datetime"/> – <input type="month"/> – <input type="week"/> – ….. • Support is not very good, only really useful on mobile devices 8
  • 9. HTML5 Semantic elements • Other more useful HTML5 elements – <video> – <audio> – <meter> – <progress> – <time> 9
  • 10. WebSockets • A bi-directional socket connection – Between a web browser and the web server • The server can push updates to the browser – Refreshing the browser to see updates is so 2012  • Not just for games and chat applications – Any application where you want fast updates – Decrease the chance of concurrency issues 10
  • 12. WebSockets • Suffers from lack of infrastructure support – Routers and firewalls can cause issues • The API is low level – Messages are just simple objects – You might need to retransmit missed messages • Use ASP.NET SignalR – Uses WebSockets if possible – Otherwise it uses fallbacks like Comet – Supports scale out scenarios – Uses a very simple API • Using Node.js? – Use Socket.IO instead 12
  • 13. Drag and Drop • Drag and drop can be a very intuitive user interaction – Often seen as more fun by users • Very common interaction on tablets – But works equally well with a mouse • HTML5 supports drag and drop – Including dragging from the file system 13
  • 14. Drag and Drop How about support? 14
  • 15. Drag and Drop • Use jQuery UI instead of the HTML5 capabilities – Use jQuery UI Touch Punch for touch support – Add -ms-touch-action: none in CSS for Windows 8 15
  • 16. Graphics • Rich graphics are common in modern applications – Interactive graphics – Charts • Often generated on the client – Not just images downloaded from the server • Two basic options – Scalable Vector Graphics – Canvas 16
  • 17. Comparison of Canvas and SVG Canvas SVG Pixel-based (canvas is essentially an image element with a drawing API) Object Model-based (SVG elements are similar to HTML elements) Single HTML element similar to <img> in behavior Multiple graphical elements which become part of the Document Object Model (DOM) Visual presentation created and modified programmatically through script Visual presentation created with markup and modified by CSS or programmatically through script Event model/user interaction is coarse—at the canvas element only; interactions must be manually programmed from mouse coordinates API does not support accessibility; markupbased techniques must be used in addition to canvas Event model/user interaction is object-based at the level of primitive graphic elements— lines, rectangles, paths SVG markup and object model directly supports accessibility 17
  • 18. SVG • How about support? 18
  • 19. Canvas • How about support? 19
  • 20. Graphics • Use a library to make the API easier – Don’t worry about Canvas versus SVG • jqPlot is great for charts – It uses canvas – Includes exCanvas for IE 7/8 support • Raphaël is a great choice for general graphics – It uses SVG – Uses VML for IE 7/8 support 20
  • 21. Storing data in the browser 21
  • 22. IndexedDB • How about support? 22
  • 24. Storing data in the browser • LocalStorage is well supported – Except in very old versions of IE • IndexedDB is much more powerful – But the API is hard to use • Lawnchair is easy to use – Abstracts the underlying data storage – Can use LocalStorage, IndexedDB or other storage • db.js makes IndexedDB easy to use – But requires a polyfill in old browsers 24
  • 25. Conclusion • There is lots of goodness in HTML5 – But not everything is as useful • Some of the API’s are hard to use – But there are good libraries to make things easier • Think about supporting older browsers – Use polyfills where needed 25
  • 26. Questions ? The presentation and source code will be available http://msmvps.com/blogs/theproblemsolver/ 26

Notes de l'éditeur

  1. {}