SlideShare a Scribd company logo
1 of 39
Maurice de Beijer
Agenda
 Why HTML5?
 How about different browsers?
 Different parts of HTML5
    Whatever you would like to see 
Who am I
 Maurice de Beijer.
 The Problem Solver.
 Microsoft CSD MVP.
 DevelopMentor instructor.
 Twitter:   @mauricedb of @HTML5SupportNL
 Blog:      http://msmvps.com/blogs/theproblemsolver/
 Web:       http://www.HTML5Support.nl
 E-mail:    mauricedb@computer.org
Why HTML5
 HTML is the most used UI technology
    But differences in browser implementation make it
     hard to work with
 Companies need to support a wide range of devices
    Bring your own hardware
    Smartphones and tablets don’t support plugins
 Users want richer applications
    Animations
    Communication
    etc.
What works in which browser?
 CanIUse.com
Google analytics - Browser & OS
 553846 visits last month
Google analytics - IE
Modernizr

 “Modernizr is an open-source JavaScript library
that helps you build the next generation of HTML5
           and CSS3-powered websites.”



           http://www.modernizr.com/
Polyfills

   “A polyfill is a piece of code (or plugin) that
 provides the technology that you, the developer,
     expect the browser to provide natively.”
Google Chrome Frame
 Use Google Chrome inside of Internet Explorer
   Works with IE 6 and later
 Only activated for pages that explicitly request it
     <meta http-equiv="X-UA-Compatible" content="chrome=1">


 The meta tag is ignored if Chrome Frame isn´t
  installed
HTML5 subjects
   Semantic markup
   Input elements
   CSS3
   Video & Audio
   Canvas & SGV
   Local storage
   Drag-Drop & File IO
   Geolocation
   Web Workers
   Offline Web applications
   Server Sent Events & WebSockets
Semantic markup
 The most commonly used CSS classes for <div>
 elements
   <div class=“nav”>
   <div class=“section”>
   <div class=“header”>
   <div class=“footer”>
   <div class=“article”>
   <div class=“aside”>
Semantic markup
 Have become HTML5 elements
    <nav>
    <section>
    <header>
    <footer>
    <article>
    <aside>
Input elements
 Most data types are entered as plain text:
      <input type="text" />
 The browser can provide additional help if it knows
  the actual data type
   search
   url
   number
   datetime
   Etc.
Input elements
 Soft keyboards can auto adjust




 http://bit.ly/InputElements
CSS 3
 Rounded corners
   .box {border-radius: 10px;}
 Drop shadows
   .box {box-shadow: 10px 5px 5px grey;}
 Gradients
   .box {background: linear-gradient(Yellow, Lime);}
 Multi column text
   article {column-count: 3; }
CSS 3
 Media queries
   @media screen and (max-width: 1024px) {
      aside {
         display: none;
      }
    }
 Transforms
   .box:hover {transform: scale(1.2);}
 Transitions
   .box {transition: transform 1s ease-in;}
Video & Audio
 HTML5 includes a <video> and <audio> element
 There is no standard encoding 
    OGV
    WEBM
    MP4
 Add multiple <source> elements
    The browser will use the first it supports
 See Wikipedia for browser support
Canvas
 A simple drawing surface
    Currently only a 2D context
    But 3D is in the works
 Uses drawing primitives
    Lines
    Rectangles
    Arcs
    Curves
    Images
    Paths
Canvas
 The entire API is JavaScript based
    There are no drawing markup elements
 Very powerful but tedious to work with
    Tooling support is limited
       Adobe® Illustrator® plugin
       Leonardo Sketch
 Used to create a HTML version of Angry Birds
    http://chrome.angrybirds.com/
Scallable Vector Graphics
 Use retained mode
    There is an object model we can manipulate
    The Canvas uses imediate mode
 Browser support is about the same as with Canvas
    Tooling support is much better
Scallable Vector Graphics
 Uses drawing shapes
    Lines
    Rectangle
    Circles
    Text
    Path
    Etc.
 Elements can be created using markup
    Or JavaScript when needed
When to use SVG versus Canvas
  Canvas                             SVG

  Pixel based (Dynamic .png)         Shape based

  Single HTML element                Multiple graphical elements,
                                     which become part of the DOM

  Modified through script only       Modified through script and CSS

  Event model/user interaction is    Event model/user interaction is
  granular (x,y)                     abstracted (rect, path)

  Performance is better with smaller Performance is better with smaller
  surface, a larger number of objects number of objects (<10k), a larger
  (>10k), or both                     surface, or both
Local storage - Web Storage
 Name – Value pair storage
    Storage is per site
    The standard recommends 5Mb storage space per site
 sessionStorage
    Valid for the duration of a browser session
 localStorage
    Valid for longer periods
 The value stored must be a string!
   sessionStorage['data'] = JSON.stringify({ value: 1 });
   data = JSON.parse(sessionStorage['data']);
Local storage - IndexedDB
 An object or NoSQL store in the database
    Only supported in Chrome en Firefox
    See demo
 There was a Web SQL Database
    It’s deprecated and replaced by the IndexedDB
    Still functional in Webkit browsers (iOS)
    Apple pushed this standard
Drag-Drop
 Move elements in the browser
    Drag files from the Windows Explorer to an HTML
     element
 Events fire for
    dragstart
    dragenter
    dragover
    drop
 The argument contain a dataTransfer object
File IO
 File IO can be done using a FileReader object
 File can be read in different ways
    readAsArrayBuffer()
    readAsBinaryString()
    readAsDataURL()
    readAsText()
 Once the file content have been read the onload
 event fires
   The result property contains the file contents
File IO
 Some file are to large to read in one action
 A Blob is a part of a file
    Use file.slice() to create a blob
 A FileReader object can work with a blob as if it is a
 file
Geolocation
 Where is the user?
    For example to do a location based search
 Always requires the users consent
 Works both on desktop and mobile browsers
    Accuracy can vary widely
 Use the navigator object
    navigator.geolocation.getCurrentPosition()
 The options support enableHighAccuracy: true
Geolocation
 The resulting Position contains at least
    latitude
    longitude
    accuracy
Web Workers
 JavaScript execution time is limited by the browser




 Using a Worker() object JavaScript can be executed in
 the background
   These scripts can execute for a long time
Web Workers
 Web Workers are limited in what they can do
    No interactions with the DOM
 They can do IO
    XMLHttpRequest
    FileReader
    importScripts()
 The Document can exchange messages with the worker
    postMessage()
    onmessage callback function is called
 All data is cloned
    Never passed by reference
Offline Web Applications
 A web application can load and execute without a
  network connection
 The cache manifest determines what resources are
  available offline
 The cached resources are always loaded from the cache
   The manifest is used to update the cache
   This is done after the page is loaded
   And only happens if the content of the cache is
    changed
Offline Web Applications
 Manifest contains sections for:
    Cache (default)
    Network
    Fallback
 The manifest must be served with the correct mime type
   text/cache-manifest
   Otherwise it’s ignored
Server Sent Events
 Push communication from the Server to the browser
    Uses standard HTTP techniques to transfer data
 Everything is just HTTP traffic
    A formalization of long polling techniques
    Be careful with connection that remain open for to long
     (30 seconds to max 2 minutes)
Server Sent Events
 EventSource object
    Functions:
       close()
   Events
       onmessage
       onopen
       onerror
         Also used when the connection is closed
WebSockets
 Full duplex communication between the browser and
  the server
 No longer HTTP traffic
   Starts as an HTTP request
   The server upgrades to WS by returning a “101 Switching
    Protocols” response
 Support is still limited
    Only Chrome and Firefox
WebSockets
 WebSocket object
   Functions:
       send() to transfer data
          Can also be binary data!

       close()
   Events
       onmessage
       onopen
       onclose
       onerror
Conclusion
 HTML 5 has a big future
    Its the only platform independent UI technology
    Even used for Windows 8 development
 Different browsers offer support for features
    Use feature detection to check what works
    Use polyfills in case of missing features
 No need to wait until it´s a standard
    Large parts are usable today

More Related Content

What's hot

Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
MongoDB
 
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
Clément Wehrung
 

What's hot (16)

Architecting For The Windows Azure Platform
Architecting For The Windows Azure PlatformArchitecting For The Windows Azure Platform
Architecting For The Windows Azure Platform
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Introduction to html5
Introduction to html5Introduction to html5
Introduction to html5
 
Novedades de MongoDB 3.6
Novedades de MongoDB 3.6Novedades de MongoDB 3.6
Novedades de MongoDB 3.6
 
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
 
What is HTML5
What is HTML5What is HTML5
What is HTML5
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
 
Velocity dust
Velocity dustVelocity dust
Velocity dust
 
Migrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at WordnikMigrating from MySQL to MongoDB at Wordnik
Migrating from MySQL to MongoDB at Wordnik
 
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
ePub 3, HTML 5 & CSS 3 (+ Fixed-Layout)
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Web
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless World
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Java on Windows Azure
Java on Windows AzureJava on Windows Azure
Java on Windows Azure
 
HTML5 Introduction
HTML5 IntroductionHTML5 Introduction
HTML5 Introduction
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 

Similar to HTML5

DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp Net
Adil Mughal
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat Client
Paul Klipp
 

Similar to HTML5 (20)

Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 
Creating Great Applications in SharePoint 2010 with Silverlight 4
Creating Great Applications in SharePoint 2010 with Silverlight 4Creating Great Applications in SharePoint 2010 with Silverlight 4
Creating Great Applications in SharePoint 2010 with Silverlight 4
 
The web as it should be
The web as it should beThe web as it should be
The web as it should be
 
Html5 Interview Questions & Answers
Html5 Interview Questions & AnswersHtml5 Interview Questions & Answers
Html5 Interview Questions & Answers
 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile apps
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
 
DevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp NetDevNext - Web Programming Concepts Using Asp Net
DevNext - Web Programming Concepts Using Asp Net
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat Client
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
Practical html5
Practical html5Practical html5
Practical html5
 
Spsmi13 charts
Spsmi13 chartsSpsmi13 charts
Spsmi13 charts
 
Bruce lawson-over-the-air
Bruce lawson-over-the-airBruce lawson-over-the-air
Bruce lawson-over-the-air
 
Edge of the Web
Edge of the WebEdge of the Web
Edge of the Web
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Buzzword, How'd They Build That?
Buzzword, How'd They Build That?Buzzword, How'd They Build That?
Buzzword, How'd They Build That?
 
HTML 5
HTML 5HTML 5
HTML 5
 

More from Maurice De Beijer [MVP]

More from 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
 

Recently uploaded

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

HTML5

  • 2. Agenda  Why HTML5?  How about different browsers?  Different parts of HTML5  Whatever you would like to see 
  • 3. Who am I  Maurice de Beijer.  The Problem Solver.  Microsoft CSD MVP.  DevelopMentor instructor.  Twitter: @mauricedb of @HTML5SupportNL  Blog: http://msmvps.com/blogs/theproblemsolver/  Web: http://www.HTML5Support.nl  E-mail: mauricedb@computer.org
  • 4. Why HTML5  HTML is the most used UI technology  But differences in browser implementation make it hard to work with  Companies need to support a wide range of devices  Bring your own hardware  Smartphones and tablets don’t support plugins  Users want richer applications  Animations  Communication  etc.
  • 5. What works in which browser?  CanIUse.com
  • 6. Google analytics - Browser & OS  553846 visits last month
  • 8. Modernizr “Modernizr is an open-source JavaScript library that helps you build the next generation of HTML5 and CSS3-powered websites.” http://www.modernizr.com/
  • 9. Polyfills “A polyfill is a piece of code (or plugin) that provides the technology that you, the developer, expect the browser to provide natively.”
  • 10. Google Chrome Frame  Use Google Chrome inside of Internet Explorer  Works with IE 6 and later  Only activated for pages that explicitly request it <meta http-equiv="X-UA-Compatible" content="chrome=1">  The meta tag is ignored if Chrome Frame isn´t installed
  • 11. HTML5 subjects  Semantic markup  Input elements  CSS3  Video & Audio  Canvas & SGV  Local storage  Drag-Drop & File IO  Geolocation  Web Workers  Offline Web applications  Server Sent Events & WebSockets
  • 12. Semantic markup  The most commonly used CSS classes for <div> elements  <div class=“nav”>  <div class=“section”>  <div class=“header”>  <div class=“footer”>  <div class=“article”>  <div class=“aside”>
  • 13. Semantic markup  Have become HTML5 elements  <nav>  <section>  <header>  <footer>  <article>  <aside>
  • 14. Input elements  Most data types are entered as plain text: <input type="text" />  The browser can provide additional help if it knows the actual data type  search  url  number  datetime  Etc.
  • 15. Input elements  Soft keyboards can auto adjust  http://bit.ly/InputElements
  • 16. CSS 3  Rounded corners .box {border-radius: 10px;}  Drop shadows .box {box-shadow: 10px 5px 5px grey;}  Gradients .box {background: linear-gradient(Yellow, Lime);}  Multi column text article {column-count: 3; }
  • 17. CSS 3  Media queries @media screen and (max-width: 1024px) { aside { display: none; } }  Transforms .box:hover {transform: scale(1.2);}  Transitions .box {transition: transform 1s ease-in;}
  • 18. Video & Audio  HTML5 includes a <video> and <audio> element  There is no standard encoding   OGV  WEBM  MP4  Add multiple <source> elements  The browser will use the first it supports  See Wikipedia for browser support
  • 19. Canvas  A simple drawing surface  Currently only a 2D context  But 3D is in the works  Uses drawing primitives  Lines  Rectangles  Arcs  Curves  Images  Paths
  • 20. Canvas  The entire API is JavaScript based  There are no drawing markup elements  Very powerful but tedious to work with  Tooling support is limited  Adobe® Illustrator® plugin  Leonardo Sketch  Used to create a HTML version of Angry Birds  http://chrome.angrybirds.com/
  • 21. Scallable Vector Graphics  Use retained mode  There is an object model we can manipulate  The Canvas uses imediate mode  Browser support is about the same as with Canvas  Tooling support is much better
  • 22. Scallable Vector Graphics  Uses drawing shapes  Lines  Rectangle  Circles  Text  Path  Etc.  Elements can be created using markup  Or JavaScript when needed
  • 23. When to use SVG versus Canvas Canvas SVG Pixel based (Dynamic .png) Shape based Single HTML element Multiple graphical elements, which become part of the DOM Modified through script only Modified through script and CSS Event model/user interaction is Event model/user interaction is granular (x,y) abstracted (rect, path) Performance is better with smaller Performance is better with smaller surface, a larger number of objects number of objects (<10k), a larger (>10k), or both surface, or both
  • 24. Local storage - Web Storage  Name – Value pair storage  Storage is per site  The standard recommends 5Mb storage space per site  sessionStorage  Valid for the duration of a browser session  localStorage  Valid for longer periods  The value stored must be a string! sessionStorage['data'] = JSON.stringify({ value: 1 }); data = JSON.parse(sessionStorage['data']);
  • 25. Local storage - IndexedDB  An object or NoSQL store in the database  Only supported in Chrome en Firefox  See demo  There was a Web SQL Database  It’s deprecated and replaced by the IndexedDB  Still functional in Webkit browsers (iOS)  Apple pushed this standard
  • 26. Drag-Drop  Move elements in the browser  Drag files from the Windows Explorer to an HTML element  Events fire for  dragstart  dragenter  dragover  drop  The argument contain a dataTransfer object
  • 27. File IO  File IO can be done using a FileReader object  File can be read in different ways  readAsArrayBuffer()  readAsBinaryString()  readAsDataURL()  readAsText()  Once the file content have been read the onload event fires  The result property contains the file contents
  • 28. File IO  Some file are to large to read in one action  A Blob is a part of a file  Use file.slice() to create a blob  A FileReader object can work with a blob as if it is a file
  • 29. Geolocation  Where is the user?  For example to do a location based search  Always requires the users consent  Works both on desktop and mobile browsers  Accuracy can vary widely  Use the navigator object  navigator.geolocation.getCurrentPosition()  The options support enableHighAccuracy: true
  • 30. Geolocation  The resulting Position contains at least  latitude  longitude  accuracy
  • 31. Web Workers  JavaScript execution time is limited by the browser  Using a Worker() object JavaScript can be executed in the background  These scripts can execute for a long time
  • 32. Web Workers  Web Workers are limited in what they can do  No interactions with the DOM  They can do IO  XMLHttpRequest  FileReader  importScripts()  The Document can exchange messages with the worker  postMessage()  onmessage callback function is called  All data is cloned  Never passed by reference
  • 33. Offline Web Applications  A web application can load and execute without a network connection  The cache manifest determines what resources are available offline  The cached resources are always loaded from the cache  The manifest is used to update the cache  This is done after the page is loaded  And only happens if the content of the cache is changed
  • 34. Offline Web Applications  Manifest contains sections for:  Cache (default)  Network  Fallback  The manifest must be served with the correct mime type  text/cache-manifest  Otherwise it’s ignored
  • 35. Server Sent Events  Push communication from the Server to the browser  Uses standard HTTP techniques to transfer data  Everything is just HTTP traffic  A formalization of long polling techniques  Be careful with connection that remain open for to long (30 seconds to max 2 minutes)
  • 36. Server Sent Events  EventSource object  Functions:  close()  Events  onmessage  onopen  onerror  Also used when the connection is closed
  • 37. WebSockets  Full duplex communication between the browser and the server  No longer HTTP traffic  Starts as an HTTP request  The server upgrades to WS by returning a “101 Switching Protocols” response  Support is still limited  Only Chrome and Firefox
  • 38. WebSockets  WebSocket object  Functions:  send() to transfer data  Can also be binary data!  close()  Events  onmessage  onopen  onclose  onerror
  • 39. Conclusion  HTML 5 has a big future  Its the only platform independent UI technology  Even used for Windows 8 development  Different browsers offer support for features  Use feature detection to check what works  Use polyfills in case of missing features  No need to wait until it´s a standard  Large parts are usable today