SlideShare a Scribd company logo
JavaScript APIs
     HTML5

                Remy Sharp
                      @rem
             standards.next
JavaScript APIs
  HTML5 & friends!

                 Remy Sharp
                       @rem
              standards.next
HTML5: 2022?
Bollocks.
APIs
•Canvas           •Geolocation
•Drag & Drop      •Local Storage
•History          •Selectors
•Inline Editing   •Server Events
•Messaging        •Web Sockets
•Of ine Apps      •Workers
•Video & Audio
APIs
•Canvas           •Geolocation
•Drag & Drop      •Local Storage
•History          •Selectors
•Inline Editing   •Server Events
•Messaging        •Web Sockets
•Of ine Apps      •Workers
•Video & Audio
APIs
•Canvas           •Geolocation
•Drag & Drop      •Local Storage
•History          •Selectors
•Inline Editing   •Server Events
•Messaging        •Web Sockets
•Of ine Apps      •Workers
•Video & Audio
APIs
•Canvas           •Geolocation
•Drag & Drop      •Local Storage
•History          •Selectors
•Inline Editing   •Server Events
•Messaging        •Web Sockets
•Of ine Apps      •Workers
•Video & Audio
APIs
•Canvas           •Geolocation
•Drag & Drop?     •Local Storage
•History          •Selectors
•Inline Editing   •Server Events
•Messaging        •Web Sockets
•Of ine Apps      •Workers
•Video & Audio
Documentation
www.whatwg.org/html5/

dev.w3.org/html5/

irc://irc.freenode.net/#whatwg
HTML5 JS APIs
HTML5 JS APIs
HTML5 JS APIs
Canvas
Canvas
document.querySelector('canvas').getContext("2d")

       http://tr.im/pRkz
document.querySelector('canvas').getContext("2d")

       http://tr.im/pRkz
Drag'n Drop
Drag'n Drop
Drag & Drop

•draggable="true"
•events: dragstart, drop, etc
•event.transferData
<div draggable="true">drag me</div>
<script>
document.querySelector('div').addEventListener(
"dragstart",
function (e) {
  e.dataTransfer.setData("arbitrary","data");
  return true;
},
true);
</script>
<div draggable="true">drag me</div>
<script>
document.querySelector('div').addEventListener(
"dragstart",
function (e) {                        ???
  e.dataTransfer.setData("arbitrary","data");
  return true;
},
true);
</script>
el.addEventListener('dragover', function (e) {
  e.preventDefault();
}, true);


el.addEventListener('drop', function (e) {
  e.stopPropagation();
  alert(e.dataTransfer.getData('arbitrary'));
}, true);
el.addEventListener('dragover', function (e) {
  e.preventDefault();
}, true);


el.addEventListener('drop', function (e) {
  e.stopPropagation();
  alert(e.dataTransfer.getData('arbitrary'));
}, true);
el.addEventListener('dragover', function (e) {
  e.preventDefault();
}, true);


el.addEventListener('drop', function (e) {
  e.stopPropagation();
  alert(e.dataTransfer.getData('arbitrary'));
}, true);
http://html5demos.com/drag
http://html5demos.com/drag
Of ine Applications
Of ine Applications
Of ine Apps


•Application cache
•Events: of ine, online
•navigator.onLine property
Enable

<html
manifest="my.manifest"
>
my.manifest

CACHE MANIFEST
images/shade.jpg
images/bin.jpg
Cache

•First line: CACHE MANIFEST
•Requires text/cache-manifest
•Recommend using versioning
•window.applicationCache
Cache

•On load will hit my.manifest
Cache

•On load will hit my.manifest
•Change manifest: trigger reload
Cache

•On load will hit my.manifest
•Change manifest: trigger reload
•applicationCache.update() force
Cache

•On load will hit my.manifest
•Change manifest: trigger reload
•applicationCache.update() force
•Cache events
HTML5 JS APIs
HTML5 JS APIs
Firefox
window.addEventListener(
 'offline', // online too
 online, // function
 true
);
function online() {
    if (navigator.onLine == false) {
        // gone offline
    } else {
        // else we're online
    }
}
http://html5demos.com/offline
http://html5demos.com/offline
navigator.onLine
Geolocation
Geolocation
Not always accurate!
HTML5 JS APIs
navigator
  .geolocation
  .getCurrentPosition(
     success,
     err
  );
HTML5 JS APIs
HTML5 JS APIs
Messaging
Messaging
Messaging

•Communicate across domains
•Across window object
•With Workers
•String transfer only
.postMessage(str)

.onMessage(event)
  event.data == str
Cross Domain

document
 .getElementById("iframe")
 .contentWindow
 .postMessage("my message");
The Catcher
window.addEventListener(
  "message",
  function(e){
    if (e.origin !== "http://example.com") {
      return;
    }

     alert(e.origin + " said: " + e.data);
  },
  false
);
Web Workers
Web Workers
•Threads
•Threads
•Native or via Gears
•Threads
•Native or via Gears
•Sandboxed
•Threads
•Native or via Gears
•Sandboxed
•Debugging?
•importScripts
•postMessage
•onmessage
•onconnect
Without
http://html5demos.com/worker
Storage
Storage
1. sessionStorage
1. sessionStorage
2. localStorage
1. sessionStorage
2. localStorage
3. database storage
Storage

sessionStorage.setItem(key, value)
sessionStorage.getItem(key)
Storage

localStorage.setItem(key, value)
localStorage.getItem(key)
And more!


Remy
Sharp
@rem
remy@leftlogic.com

html5demos.com
remysharp.com
full-frontal.org

More Related Content

What's hot (20)

PDF
Taiwan Web Standards Talk 2011
Zi Bin Cheah
 
PDF
Web Standards: Fueling Innovation [Web Design World Boston '08]
Aaron Gustafson
 
PPTX
HTML5: An Overview
Nagendra Um
 
PDF
Building an HTML5 Video Player
Jim Jeffers
 
PDF
HTML5 and the web of tomorrow!
Christian Heilmann
 
PDF
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
PDF
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dee Sadler
 
PPTX
Html5 Overview
Daniel Arndt Alves
 
PDF
Web Standards
Helior Colorado
 
ODP
HTML5
Hatem Mahmoud
 
PDF
Game Development Using HTML 5
osa_ora
 
PDF
Real World Web Standards
gleddy
 
PDF
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
Aaron Gustafson
 
PPTX
New Elements & Features in HTML5
Jamshid Hashimi
 
PDF
jQuery UI and Plugins
Marc Grabanski
 
PPTX
Introduction to HTML5 & CSS3
Pradeep Varadaraja Banavara
 
PPT
High Performance Ajax Applications
Julien Lecomte
 
KEY
WHAT IS HTML5? (at CSS Nite Osaka)
Shumpei Shiraishi
 
PDF
An Introduction To HTML5
Robert Nyman
 
PDF
Building mobile applications with DrupalGap
Alex S
 
Taiwan Web Standards Talk 2011
Zi Bin Cheah
 
Web Standards: Fueling Innovation [Web Design World Boston '08]
Aaron Gustafson
 
HTML5: An Overview
Nagendra Um
 
Building an HTML5 Video Player
Jim Jeffers
 
HTML5 and the web of tomorrow!
Christian Heilmann
 
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dee Sadler
 
Html5 Overview
Daniel Arndt Alves
 
Web Standards
Helior Colorado
 
Game Development Using HTML 5
osa_ora
 
Real World Web Standards
gleddy
 
HTML5 Semantics, Accessibility & Forms [Carsonified HTML5 Online Conference]
Aaron Gustafson
 
New Elements & Features in HTML5
Jamshid Hashimi
 
jQuery UI and Plugins
Marc Grabanski
 
Introduction to HTML5 & CSS3
Pradeep Varadaraja Banavara
 
High Performance Ajax Applications
Julien Lecomte
 
WHAT IS HTML5? (at CSS Nite Osaka)
Shumpei Shiraishi
 
An Introduction To HTML5
Robert Nyman
 
Building mobile applications with DrupalGap
Alex S
 

Viewers also liked (16)

PDF
Echo HTML5
Nathan Smith
 
PDF
Cultura de la Convergencia de Henry Jenkins
Cristina Echenique
 
PDF
Vacuna frente al meningococo b
javithink
 
PPTX
Breaking Up with Bad Training - How to design learning people love
Judy Albers
 
PPTX
Cv workshop cambridge connect
Simone Castello
 
PDF
CALENDARIO Infantil 1º
Jordi Masnou
 
PDF
Open access survey
Elsevier
 
PDF
Sanità, finalmente si cambia: spesa sotto controllo, più qualità nelle cure, ...
RegioneLazio
 
PDF
New base 1015 special 29 march 2017 energy news
Khaled Al Awadi
 
PPTX
Calling out to Spirulina Growers- Join Spirulina.Network
Ditsa Keren
 
PPTX
How to report bugs
Mahmoud Asadi
 
PDF
Some-viestinnän kehitystrendit 2017 - Miten pysyä kehityksessä mukana?
Sanna Ketonen-Oksi
 
PDF
Vervoersplan 12/2017 > 2020: Brussels Hoofdstedelijk Gewest
NMBS
 
PPTX
Empowering and Enabling Teachers
EduSkills OECD
 
PDF
Livre blanc adaptive learning domoscio
Matthieu Cisel
 
PPTX
How to Crowdsource Product Feedback
Pushpa Ithal (Chandrashekaraiah)
 
Echo HTML5
Nathan Smith
 
Cultura de la Convergencia de Henry Jenkins
Cristina Echenique
 
Vacuna frente al meningococo b
javithink
 
Breaking Up with Bad Training - How to design learning people love
Judy Albers
 
Cv workshop cambridge connect
Simone Castello
 
CALENDARIO Infantil 1º
Jordi Masnou
 
Open access survey
Elsevier
 
Sanità, finalmente si cambia: spesa sotto controllo, più qualità nelle cure, ...
RegioneLazio
 
New base 1015 special 29 march 2017 energy news
Khaled Al Awadi
 
Calling out to Spirulina Growers- Join Spirulina.Network
Ditsa Keren
 
How to report bugs
Mahmoud Asadi
 
Some-viestinnän kehitystrendit 2017 - Miten pysyä kehityksessä mukana?
Sanna Ketonen-Oksi
 
Vervoersplan 12/2017 > 2020: Brussels Hoofdstedelijk Gewest
NMBS
 
Empowering and Enabling Teachers
EduSkills OECD
 
Livre blanc adaptive learning domoscio
Matthieu Cisel
 
How to Crowdsource Product Feedback
Pushpa Ithal (Chandrashekaraiah)
 
Ad

Similar to HTML5 JS APIs (20)

PPTX
HTML5 for Rich User Experience
Mahbubur Rahman
 
KEY
Html 5 boot camp
Laurie Young
 
PPTX
Introduction to html5
Muktadiur Rahman
 
PDF
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
PPTX
HTML5 on Mobile
Adam Lu
 
PDF
HTML5: huh, what is it good for?
Remy Sharp
 
PDF
HTML5 and Google Chrome - DevFest09
mihaiionescu
 
PPTX
Html5
Zahin Omar Alwa
 
PDF
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
PDF
HTML Online Course HTML Course Online online html courses html online training
Evanta Technologies
 
PDF
Building great mobile apps: Somethings you might want to know
shwetank
 
PDF
HTML5 New Features and Resources
Ron Reiter
 
PPTX
Edge of the Web
Todd Anglin
 
PDF
Front-end. Global domination
Stfalcon Meetups
 
PDF
Frontend. Global domination.
Андрей Вандакуров
 
PDF
APIs, now and in the future
Chris Mills
 
PDF
Web app and more
faming su
 
PDF
Web Apps and more
Yan Shi
 
HTML5 for Rich User Experience
Mahbubur Rahman
 
Html 5 boot camp
Laurie Young
 
Introduction to html5
Muktadiur Rahman
 
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
HTML5 on Mobile
Adam Lu
 
HTML5: huh, what is it good for?
Remy Sharp
 
HTML5 and Google Chrome - DevFest09
mihaiionescu
 
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
HTML Online Course HTML Course Online online html courses html online training
Evanta Technologies
 
Building great mobile apps: Somethings you might want to know
shwetank
 
HTML5 New Features and Resources
Ron Reiter
 
Edge of the Web
Todd Anglin
 
Front-end. Global domination
Stfalcon Meetups
 
Frontend. Global domination.
Андрей Вандакуров
 
APIs, now and in the future
Chris Mills
 
Web app and more
faming su
 
Web Apps and more
Yan Shi
 
Ad

More from Remy Sharp (20)

PDF
HTML5: where flash isn't needed anymore
Remy Sharp
 
PDF
Yearning jQuery
Remy Sharp
 
PDF
Is HTML5 Ready? (workshop)
Remy Sharp
 
PDF
Forget the Web
Remy Sharp
 
PDF
Interaction Implementation
Remy Sharp
 
PDF
jQuery: out with the old, in with the new
Remy Sharp
 
PDF
HTML5 tutorial: canvas, offfline & sockets
Remy Sharp
 
PDF
Developing for Mobile
Remy Sharp
 
PDF
Browsers with Wings
Remy Sharp
 
PDF
Webapps without the web
Remy Sharp
 
PDF
TwitterLib.js
Remy Sharp
 
PDF
HTML5: friend or foe (to Flash)?
Remy Sharp
 
PDF
codebits 2009 HTML5 JS APIs
Remy Sharp
 
PDF
HTML5 JavaScript APIs
Remy Sharp
 
PDF
iPhone Appleless Apps
Remy Sharp
 
PDF
jQuery Loves Developers - Oredev 2009
Remy Sharp
 
PDF
Write Less Do More
Remy Sharp
 
PDF
jQuery Loves Developers - SWDC2009
Remy Sharp
 
PDF
DOM Scripting Toolkit - jQuery
Remy Sharp
 
PDF
Prototype & jQuery
Remy Sharp
 
HTML5: where flash isn't needed anymore
Remy Sharp
 
Yearning jQuery
Remy Sharp
 
Is HTML5 Ready? (workshop)
Remy Sharp
 
Forget the Web
Remy Sharp
 
Interaction Implementation
Remy Sharp
 
jQuery: out with the old, in with the new
Remy Sharp
 
HTML5 tutorial: canvas, offfline & sockets
Remy Sharp
 
Developing for Mobile
Remy Sharp
 
Browsers with Wings
Remy Sharp
 
Webapps without the web
Remy Sharp
 
TwitterLib.js
Remy Sharp
 
HTML5: friend or foe (to Flash)?
Remy Sharp
 
codebits 2009 HTML5 JS APIs
Remy Sharp
 
HTML5 JavaScript APIs
Remy Sharp
 
iPhone Appleless Apps
Remy Sharp
 
jQuery Loves Developers - Oredev 2009
Remy Sharp
 
Write Less Do More
Remy Sharp
 
jQuery Loves Developers - SWDC2009
Remy Sharp
 
DOM Scripting Toolkit - jQuery
Remy Sharp
 
Prototype & jQuery
Remy Sharp
 

Recently uploaded (20)

PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 

HTML5 JS APIs