SlideShare une entreprise Scribd logo
1  sur  40
Maurice de Beijer
Waar gaan we het over hebben?
 Waarom HTML5?
 Wie beslist wat HTML5 is?
 Hoe gaan browsers er mee om?
 Verschillende HTML5 onderdelen
Wie ben ik
 Maurice de Beijer.
 The Problem Solver.
 Microsoft CSD MVP.
 DevelopMentor instructor.
 Twitter:   @mauricedb of @HTML5Support
 Blog:      http://msmvps.com/blogs/
             theproblemsolver/default.aspx
 Web:       http://www.HTML5Support.nl
 E-mail:    mauricedb@computer.org
Waarom HTML5
 HTML is de meest verspreide UI technologie
    Maar door browser verschillen lastig om mee te
     werken
 Minder bedrijven ondersteunen een enkel platform
    Bring your own hardware
    Smartphones en tablets ondersteunen geen plugins
 Men wil rijkere applicaties
    Animaties
    Communicatie
    etc
Wie gaat er eigenlijk over?
 De World Wide Web Consortium (W3C)
    Was oorspronkelijk met XHTML2 bezig
 Web Hypertext Application Technology Working
 Group (WHATWG)
   In 2004 begonnen uit onvrede met XHTML2
 Vanaf 2009 samen bezig
    Er wordt gewerkt aan “HTML The Living Standard”
 De W3C neemt een snapshot
    Dat wordt HTML5
Wanneer is het klaar?

  “The Web Hypertext Application Technology
  Working Group, expects HTML5 to reach W3C
 Candidate Recommendation Stage in 2012, and
  graduate to W3C Recommendation in 2022.”
Wanneer is het klaar?

  “The Web Hypertext Application Technology
  Working Group, expects HTML5 to reach W3C
 Candidate Recommendation Stage in 2012, and
  graduate to W3C Recommendation in 2022.”
Hoe zit het met de browsers?
 Yahoo Graded Browser Support
Google analytics - msmvps.org
 762098 bezoeken laatste maand
Google analytics - msmvps.org
Wat werkt in welke browser?
 CanIUse.com
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
 Gebruik Google Chrome binnen Internet Explorer 6 of
  hoger
 Wordt alleen gebruikt als er specifiek om gevraagd
  wordt
   Kan ook voor specifieke versies van IE
    <meta http-equiv="X-UA-Compatible" content="chrome=1">


 Doet niets als Chrome Frame niet geinstalleerd is.
Onderwerpen
   Semantic markup
   Input elementen
   CSS3
   Video & Audio
   Canvas
   Local storage
   Drag-Drop & File IO
   Geolocation
   Web Workers
   Offline Web applications
   Server Sent Events & WebSockets
Semantic markup
 Het gaat om de data, niet hoe het er uit ziet!
 De meest gebruikte CSS classes bij <div> elementen
    <div class=“nav”>
    <div class=“section”>
    <div class=“header”>
    <div class=“footer”>
    <div class=“article”>
    <div class=“aside”>
Semantic markup
 Nu zijn het HTML5 elementen
   <nav>
   <section>
   <header>
   <footer>
   <article>
   <aside>
Input elementen
 De meeste data types moeten met:
      <input type="text" />
 De browser kan helpen als het weet om wat voor
  data het gaat
   search
   url
   number
   datetime
   Etc.
Input elementen
 Softkeyboards passen zich aan




 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
 Er is een nieuw <video> en <audio> element
 Er is echter geen standaard encoding 
    OGV
    WEBM
    MP4
 Meerdere <source> elementen opgeven
    De browser kiest de eerste die werkt
 Zie Wikipedia voor browser ondersteuning
Canvas
 Een vlak om op te tekenen
    Op dit moment is er alleen een 2D context
 Primitives die je kunt tekenen
    Lines
    Rectangles
    Arcs
    Curves
    Images
    Paths
Canvas
 De hele API wordt via JavaScript aangestuurd
 Zeer krachtig maar lastig om mee te werken
    Er zijn nog niet veel tools
       Adobe® Illustrator® plugin
       Leonardo Sketch
 Er is een AngryBirds versie mee gemaakt
    http://chrome.angrybirds.com/
Local storage - Web Storage
 Name – Value pair storage
    Storage is per site
    Het advies voor browsers is 5Mb max ruimte per site
 sessionStorage
    Geldig gedurende de browser sessie
 localStorage
    Blijft langer bestaan
 De value moet een string zijn!
   sessionStorage['data'] = JSON.stringify({ value: 1 });
   data = JSON.parse(sessionStorage['data']);
Local storage - IndexedDB
 Een object of NoSQL store in de database
    Werkt alleen in Chrome en FireFox
    Zie demo
 Er was een Web SQL Database
    Is deprecated en vervangen door de IndexedDB
    Werkt nog wel in Webkit browsers (iOS)
Drag-Drop
 Elementen verslepen in de browser
    Ook files uit de Windows Explorer naar een HTML
     element
 Events voor
    dragstart
    dragenter
    dragover
    drop
 Argument bevat een dataTransfer object
File IO
 File IO met een FileReader object
 File kan op verschillende manieren gelezen worden
    readAsArrayBuffer()
    readAsBinaryString()
    readAsDataURL()
    readAsText()
 Als de file gelezen is gaat het onload event af
    De result property bevat de inhoud
File IO
 Soms is een file te groot om helemaal te lezen
 Een Blob is een deel van een file
    Met een file.slice() kan je een blob maken
 Een FileReader object kan ook met een blob werken
Geolocation
 Waar is iemand?
    Bijvoorbeeld om een location based search te doen
 De gebruiker moet toestemming geven
 Werkt zowel in desktop als mobiele browsers
    Nauwkeurigheid kan sterk varieren
 Via het navigator object te vinden
    navigator.geolocation.getCurrentPosition()
 De options ondersteunt
 enableHighAccuracy: true
Geolocation
 De Position bevat minimaal
    latitude
    longitude
    accuracy
Web Workers
 JavaScript mag niet te lang duren van de browser




 Via een Worker() object kan een JavaScript file in de
 achtergrond gestart worden
   Kan wel langer duren
Web Workers
 Web Workers zijn beperkt in wat ze mogen doen
    Niets met het document
 Mogen wel IO doen
    XMLHttpRequest
    FileReader
    importScripts()
 Document kan berichten met worker uitwisselen
    postMessage()
    onmessage callback functie wordt aangeroepen
 Alle data wordt gekloond
Offline Web Applications
 Een web app kan ook draaien zonder dat er een
  netwerk verbinding is
 Via een cache manifest wordt er bepaald wat voor
  offline beschikt is
 De cached resources komen altijd uit de cache
   Het manifest wordt gebruikt om de cache bij te werken
   Dit gebeurt pas nadat de pagina getoond is
   Alleen als de inhoud van het manifest anders is
Offline Web Applications
 Manifest bevat secties voor:
    Cache (default)
    Network
    Fallback
 Het manifest moet het juiste mime type hebben:
  text/cache-manifest
Server Sent Events
 Push communicatie van de Server naar de browser
    Gebruik standaard technieken om data naar de server te
     sturen.
 Alles is gewoon HTTP verkeer
    Is eigenlijk gewoon long polling
    Pas op met verbindingen die te lang open blijven
     (30 seconden to max 2 minuten)
Server Sent Events
 EventSource object
    Functies:
       close()
   Events
       onmessage
       onopen
       onerror
         Gaat ook af als de verbinding gesloten wordt
WebSockets
 Duplex communictatie tussen de browser en de server
 Geen HTTP verkeer
    Begint wel als HTTP verkeer
    Server doet een upgrade naar WS dmv een “101
     Switching Protocols” response
 Ondersteuning is nog beperkt
    Alleen Chrome en FireFox (met prefix)
WebSockets
 WebSocket object
   Functies:
       send() om data te sturen
          Kan ook binary data zijn!

       close()
   Events voor als er wat gebeurt
       onmessage
       onopen
       onclose
       onerror
Conclusie
 HTML 5 heeft een grote toekomst
    Het is de enige platform onafhankelijke UI techniek
    Zelfs binnen Windows 8 is het belangrijk
 Diverse browsers ondersteunen verschillende
  onderdelen
   Gebruik feature detection om te zien wat wel en niet
   Gebruik polyfills om ontbrekende stukken aan te vullen
 Je hoeft niet te wachten tot het klaar is
    Begin nu en maak betere web applicaties

Contenu connexe

Similaire à HTML5 Overview

Third Generation Internet Applications
Third Generation Internet ApplicationsThird Generation Internet Applications
Third Generation Internet ApplicationsPatrick Koning
 
Ict2 trm- werking internet
Ict2 trm- werking internetIct2 trm- werking internet
Ict2 trm- werking internetkaatversele
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDavid Coppoolse
 
Bouwstenen voor een moderne webapplicatie
Bouwstenen voor een moderne webapplicatieBouwstenen voor een moderne webapplicatie
Bouwstenen voor een moderne webapplicatieSWIS_Webprojecten
 
20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie BramFARO
 
20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie BramFARO
 
Nord Toelichting Techniek
Nord Toelichting TechniekNord Toelichting Techniek
Nord Toelichting Techniektjercus
 
NL Front-end Guidelines (HTML,CSS,Javascript)
NL Front-end Guidelines (HTML,CSS,Javascript)NL Front-end Guidelines (HTML,CSS,Javascript)
NL Front-end Guidelines (HTML,CSS,Javascript)Mathijs Jong
 
DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)dpc
 
metadata & open source #osgeonl dag 2012
metadata & open source #osgeonl dag 2012 metadata & open source #osgeonl dag 2012
metadata & open source #osgeonl dag 2012 pvangenuchten
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceguesta83c7d
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceguesta83c7d
 

Similaire à HTML5 Overview (20)

Refresher HTML(5) and CSS(3) - CC FE & UX
Refresher HTML(5) and CSS(3) - CC FE & UXRefresher HTML(5) and CSS(3) - CC FE & UX
Refresher HTML(5) and CSS(3) - CC FE & UX
 
Third Generation Internet Applications
Third Generation Internet ApplicationsThird Generation Internet Applications
Third Generation Internet Applications
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 
Alles Over Api's
Alles Over Api'sAlles Over Api's
Alles Over Api's
 
Html5 App
Html5 AppHtml5 App
Html5 App
 
Ict2 trm- werking internet
Ict2 trm- werking internetIct2 trm- werking internet
Ict2 trm- werking internet
 
HTML5 & rest services
HTML5 & rest servicesHTML5 & rest services
HTML5 & rest services
 
Android
AndroidAndroid
Android
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
 
Bouwstenen voor een moderne webapplicatie
Bouwstenen voor een moderne webapplicatieBouwstenen voor een moderne webapplicatie
Bouwstenen voor een moderne webapplicatie
 
Excellent rest met de web api
Excellent rest met de web apiExcellent rest met de web api
Excellent rest met de web api
 
20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram
 
20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram20081126 Hands On Presentatie Bram
20081126 Hands On Presentatie Bram
 
Web2.0 Web3.0
Web2.0 Web3.0Web2.0 Web3.0
Web2.0 Web3.0
 
Nord Toelichting Techniek
Nord Toelichting TechniekNord Toelichting Techniek
Nord Toelichting Techniek
 
NL Front-end Guidelines (HTML,CSS,Javascript)
NL Front-end Guidelines (HTML,CSS,Javascript)NL Front-end Guidelines (HTML,CSS,Javascript)
NL Front-end Guidelines (HTML,CSS,Javascript)
 
DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)
 
metadata & open source #osgeonl dag 2012
metadata & open source #osgeonl dag 2012 metadata & open source #osgeonl dag 2012
metadata & open source #osgeonl dag 2012
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open source
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_source
 

Plus de Maurice De Beijer [MVP]

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 AppMaurice De Beijer [MVP]
 
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 ProjectMaurice De Beijer [MVP]
 
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 CypressMaurice De Beijer [MVP]
 
Build reliable Svelte applications using Cypress
Build reliable Svelte applications using CypressBuild reliable Svelte applications using Cypress
Build reliable Svelte applications using CypressMaurice De Beijer [MVP]
 
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 & AzureMaurice De Beijer [MVP]
 
Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Concurrent Rendering Adventures in React 18
Concurrent Rendering Adventures in React 18Maurice De Beijer [MVP]
 
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 AzureMaurice De Beijer [MVP]
 
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 ReactMaurice De Beijer [MVP]
 
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 & AzureMaurice De Beijer [MVP]
 
Building reliable web applications using Cypress
Building reliable web applications using CypressBuilding reliable web applications using Cypress
Building reliable web applications using CypressMaurice De Beijer [MVP]
 
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 renderingMaurice De Beijer [MVP]
 
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 HitchcockMaurice De Beijer [MVP]
 
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 JavaScriptMaurice De Beijer [MVP]
 
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 JavaScriptMaurice De Beijer [MVP]
 
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 apisMaurice 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
 

HTML5 Overview

  • 2. Waar gaan we het over hebben?  Waarom HTML5?  Wie beslist wat HTML5 is?  Hoe gaan browsers er mee om?  Verschillende HTML5 onderdelen
  • 3. Wie ben ik  Maurice de Beijer.  The Problem Solver.  Microsoft CSD MVP.  DevelopMentor instructor.  Twitter: @mauricedb of @HTML5Support  Blog: http://msmvps.com/blogs/ theproblemsolver/default.aspx  Web: http://www.HTML5Support.nl  E-mail: mauricedb@computer.org
  • 4. Waarom HTML5  HTML is de meest verspreide UI technologie  Maar door browser verschillen lastig om mee te werken  Minder bedrijven ondersteunen een enkel platform  Bring your own hardware  Smartphones en tablets ondersteunen geen plugins  Men wil rijkere applicaties  Animaties  Communicatie  etc
  • 5. Wie gaat er eigenlijk over?  De World Wide Web Consortium (W3C)  Was oorspronkelijk met XHTML2 bezig  Web Hypertext Application Technology Working Group (WHATWG)  In 2004 begonnen uit onvrede met XHTML2  Vanaf 2009 samen bezig  Er wordt gewerkt aan “HTML The Living Standard”  De W3C neemt een snapshot  Dat wordt HTML5
  • 6. Wanneer is het klaar? “The Web Hypertext Application Technology Working Group, expects HTML5 to reach W3C Candidate Recommendation Stage in 2012, and graduate to W3C Recommendation in 2022.”
  • 7. Wanneer is het klaar? “The Web Hypertext Application Technology Working Group, expects HTML5 to reach W3C Candidate Recommendation Stage in 2012, and graduate to W3C Recommendation in 2022.”
  • 8. Hoe zit het met de browsers?  Yahoo Graded Browser Support
  • 9. Google analytics - msmvps.org  762098 bezoeken laatste maand
  • 10. Google analytics - msmvps.org
  • 11. Wat werkt in welke browser?  CanIUse.com
  • 12. 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/
  • 13. Polyfills “A polyfill is a piece of code (or plugin) that provides the technology that you, the developer, expect the browser to provide natively.”
  • 14. Google Chrome Frame  Gebruik Google Chrome binnen Internet Explorer 6 of hoger  Wordt alleen gebruikt als er specifiek om gevraagd wordt  Kan ook voor specifieke versies van IE <meta http-equiv="X-UA-Compatible" content="chrome=1">  Doet niets als Chrome Frame niet geinstalleerd is.
  • 15. Onderwerpen  Semantic markup  Input elementen  CSS3  Video & Audio  Canvas  Local storage  Drag-Drop & File IO  Geolocation  Web Workers  Offline Web applications  Server Sent Events & WebSockets
  • 16. Semantic markup  Het gaat om de data, niet hoe het er uit ziet!  De meest gebruikte CSS classes bij <div> elementen  <div class=“nav”>  <div class=“section”>  <div class=“header”>  <div class=“footer”>  <div class=“article”>  <div class=“aside”>
  • 17. Semantic markup  Nu zijn het HTML5 elementen  <nav>  <section>  <header>  <footer>  <article>  <aside>
  • 18. Input elementen  De meeste data types moeten met: <input type="text" />  De browser kan helpen als het weet om wat voor data het gaat  search  url  number  datetime  Etc.
  • 19. Input elementen  Softkeyboards passen zich aan  http://bit.ly/InputElements
  • 20. 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; }
  • 21. 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;}
  • 22. Video & Audio  Er is een nieuw <video> en <audio> element  Er is echter geen standaard encoding   OGV  WEBM  MP4  Meerdere <source> elementen opgeven  De browser kiest de eerste die werkt  Zie Wikipedia voor browser ondersteuning
  • 23. Canvas  Een vlak om op te tekenen  Op dit moment is er alleen een 2D context  Primitives die je kunt tekenen  Lines  Rectangles  Arcs  Curves  Images  Paths
  • 24. Canvas  De hele API wordt via JavaScript aangestuurd  Zeer krachtig maar lastig om mee te werken  Er zijn nog niet veel tools  Adobe® Illustrator® plugin  Leonardo Sketch  Er is een AngryBirds versie mee gemaakt  http://chrome.angrybirds.com/
  • 25. Local storage - Web Storage  Name – Value pair storage  Storage is per site  Het advies voor browsers is 5Mb max ruimte per site  sessionStorage  Geldig gedurende de browser sessie  localStorage  Blijft langer bestaan  De value moet een string zijn! sessionStorage['data'] = JSON.stringify({ value: 1 }); data = JSON.parse(sessionStorage['data']);
  • 26. Local storage - IndexedDB  Een object of NoSQL store in de database  Werkt alleen in Chrome en FireFox  Zie demo  Er was een Web SQL Database  Is deprecated en vervangen door de IndexedDB  Werkt nog wel in Webkit browsers (iOS)
  • 27. Drag-Drop  Elementen verslepen in de browser  Ook files uit de Windows Explorer naar een HTML element  Events voor  dragstart  dragenter  dragover  drop  Argument bevat een dataTransfer object
  • 28. File IO  File IO met een FileReader object  File kan op verschillende manieren gelezen worden  readAsArrayBuffer()  readAsBinaryString()  readAsDataURL()  readAsText()  Als de file gelezen is gaat het onload event af  De result property bevat de inhoud
  • 29. File IO  Soms is een file te groot om helemaal te lezen  Een Blob is een deel van een file  Met een file.slice() kan je een blob maken  Een FileReader object kan ook met een blob werken
  • 30. Geolocation  Waar is iemand?  Bijvoorbeeld om een location based search te doen  De gebruiker moet toestemming geven  Werkt zowel in desktop als mobiele browsers  Nauwkeurigheid kan sterk varieren  Via het navigator object te vinden  navigator.geolocation.getCurrentPosition()  De options ondersteunt enableHighAccuracy: true
  • 31. Geolocation  De Position bevat minimaal  latitude  longitude  accuracy
  • 32. Web Workers  JavaScript mag niet te lang duren van de browser  Via een Worker() object kan een JavaScript file in de achtergrond gestart worden  Kan wel langer duren
  • 33. Web Workers  Web Workers zijn beperkt in wat ze mogen doen  Niets met het document  Mogen wel IO doen  XMLHttpRequest  FileReader  importScripts()  Document kan berichten met worker uitwisselen  postMessage()  onmessage callback functie wordt aangeroepen  Alle data wordt gekloond
  • 34. Offline Web Applications  Een web app kan ook draaien zonder dat er een netwerk verbinding is  Via een cache manifest wordt er bepaald wat voor offline beschikt is  De cached resources komen altijd uit de cache  Het manifest wordt gebruikt om de cache bij te werken  Dit gebeurt pas nadat de pagina getoond is  Alleen als de inhoud van het manifest anders is
  • 35. Offline Web Applications  Manifest bevat secties voor:  Cache (default)  Network  Fallback  Het manifest moet het juiste mime type hebben: text/cache-manifest
  • 36. Server Sent Events  Push communicatie van de Server naar de browser  Gebruik standaard technieken om data naar de server te sturen.  Alles is gewoon HTTP verkeer  Is eigenlijk gewoon long polling  Pas op met verbindingen die te lang open blijven (30 seconden to max 2 minuten)
  • 37. Server Sent Events  EventSource object  Functies:  close()  Events  onmessage  onopen  onerror  Gaat ook af als de verbinding gesloten wordt
  • 38. WebSockets  Duplex communictatie tussen de browser en de server  Geen HTTP verkeer  Begint wel als HTTP verkeer  Server doet een upgrade naar WS dmv een “101 Switching Protocols” response  Ondersteuning is nog beperkt  Alleen Chrome en FireFox (met prefix)
  • 39. WebSockets  WebSocket object  Functies:  send() om data te sturen  Kan ook binary data zijn!  close()  Events voor als er wat gebeurt  onmessage  onopen  onclose  onerror
  • 40. Conclusie  HTML 5 heeft een grote toekomst  Het is de enige platform onafhankelijke UI techniek  Zelfs binnen Windows 8 is het belangrijk  Diverse browsers ondersteunen verschillende onderdelen  Gebruik feature detection om te zien wat wel en niet  Gebruik polyfills om ontbrekende stukken aan te vullen  Je hoeft niet te wachten tot het klaar is  Begin nu en maak betere web applicaties