Professional Documents
Culture Documents
Safari 4.0b: Feb 29, 2009 canvas iPhone 2.2: video Nov 22, 2008 app cache canvas database app cache workers database SVG SVG
Chrome 2.0: May 21, 2009 canvas Firefox 3.5b4: video Apr 27, 2009 geolocation canvas app cache video database geolocation workers app cache SVG Android 1.5: database Apr 13, 2009 workers canvas SVG geolocation app cache database workers
User Experience
native
web
Q109
Q209
...
User Experience
Graphics
Location
Storage
Speed
native
web
Q109
Q209
...
More Developers
300
225
150
75
2002
2003
2004
2005
2006
2007
2008
2009
More Users
450
350
250
150
50
2005
2006
2007
2008
2009
More Speed
80
60
20
2001
2003
2005
2007
Q108
Q208
Q308
Q408
Q109
5>4
Wednesday, October 7, 2009
css (1996)
xhr (1999)
canvas/SVG
video
geolocation
web workers
width
height
javascript:onClick(Draw());
Wednesday, October 7, 2009
DOM
Transparent Stack
HTML
HTTP
15
<rect
15
15
15
15
15
<rect x="0" y="0" width="100" height="100" fill="blue" stroke="red" stroke-width="5px" rx="8" ry="8"
15
<rect x="0" y="0" width="100" height="100" fill="blue" stroke="red" stroke-width="5px" rx="8" ry="8" id="myRect" class="chart" />
15
<rect x="0" y="0" width="100" height="100" fill="blue" stroke="red" stroke-width="5px" rx="8" ry="8" id="myRect" class="chart" />
15
15
16
16
16
16
17
Canvas API
JavaScript API ("Scriptable Image Tag")
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas>
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas');
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d');
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "rgb(200,0,0)";
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50);
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 55, 50);
18
Canvas API
JavaScript API ("Scriptable Image Tag")
<canvas id="myCanvas" width="150" height="150"> </canvas> var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 55, 50);
18
Mozilla Download Center (FF) First Person Gifter (FF) Population Demo (FF) Bespin (Safari) German Election Atlas (Safari)
20
SVG -> High level Import/Export Easy UIs Interactive Medium Animation Tree of objects
20
SVG -> High level Import/Export Easy UIs Interactive Medium Animation Tree of objects
Canvas -> Low level No mouse interaction High Animation JS Centric More Bookkeeping Pixels
20
HTML 5 Support
Chrome
canvas/SVG
Firefox
Safari
Opera
video
geolocation
app cache
database
workers
http://tinyurl.com/mbw73x
http://tinyurl.com/mbw73x
canvas/SVG
video
geolocation
web workers
Embedding Video
27
Embedding Video
27
Embedding Video
<video src="http://example.com/myMovie.ogg" controls> Your browser does not support the video element.
27
Embedding Video
<video src="http://example.com/myMovie.ogg" controls> Your browser does not support the video element. </video>
27
28
28
<video> demos
HTML 5 Support
Chrome
canvas/SVG
Firefox
Safari
Opera
video
geolocation
app cache
database
workers
canvas/SVG
video
geolocation
web workers
CRM
Social
Ads
Photos
Games
2.1 mi
1.1 mi
500 ft
20 ft
75 ft
Wednesday, October 7, 2009
Geolocation Sample
35
Geolocation Sample
navigator.geolocation.getCurrentPosition(
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) {
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) { var lat = position.coords.latitude;
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude;
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; showLocation(lat, lon);
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; showLocation(lat, lon); }
35
Geolocation Sample
navigator.geolocation.getCurrentPosition( function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; showLocation(lat, lon); } );
35
geolocation demos
HTML 5 Support
Chrome
canvas/SVG
Firefox
Safari
Opera
video
geolocation
(iPhone)
app cache
database
workers
canvas/SVG
video
geolocation
web workers
// database and app cache store user data and app resources locally
Wednesday, October 7, 2009
App Cache
List resources that you want to take offline
CACHE MANIFEST /static/stickies.html /media/deleteButton.png /media/deleteButtonPressed.png /css/stickies.css /js/stickies.js
42
App Cache
List resources that you want to take offline
CACHE MANIFEST /static/stickies.html /media/deleteButton.png /media/deleteButtonPressed.png /css/stickies.css /js/stickies.js <body manifest="./cache.manifest"> </body>
42
Database
Wednesday, October 7, 2009
Database
44
Database
var db = window.openDatabase("NoteTest", "1.0",
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB",
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000);
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) {
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction(
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) {
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql(
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes "
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) "
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) " + "VALUES (?, ?, ?, ?, ?, ?)",
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) " + "VALUES (?, ?, ?, ?, ?, ?)", [id, text, timestamp, left, top, zIndex]);
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) " + "VALUES (?, ?, ?, ?, ?, ?)", [id, text, timestamp, left, top, zIndex]); }
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) " + "VALUES (?, ?, ?, ?, ?, ?)", [id, text, timestamp, left, top, zIndex]); } );
44
Database
var db = window.openDatabase("NoteTest", "1.0", "Example DB", 200000); function saveMe(id, text, timestamp, left, top, zIndex) { db.transaction( function (tx) { tx.executeSql( "INSERT INTO WebKitStickyNotes " + "(id, note, timestamp, left, top, zindex) " + "VALUES (?, ?, ?, ?, ?, ?)", [id, text, timestamp, left, top, zIndex]); } ); }
44
HTML 5 Support
Chrome
canvas/SVG
Firefox
Safari
Opera
video
geolocation
(iPhone)
app cache
(mobile)
database
(mobile)
workers
canvas/SVG
video
geolocation
web workers
I will not hose the browser with JavaScript I will not hose the browser with JavaScript I will not hose the browser with JavaScript I will not hose the browser with JavaScript I will not hose the browser with JavaScript I will not hose the browser with JavaScript
Bad Primes (FF 3.5) Good Primes (FF 3.5) Motion Tracker (FF)
Web Workers
51
Web Workers
<script>
51
Web Workers
<script> var worker = new Worker('worker.js');
51
Web Workers
<script> var worker = new Worker('worker.js'); worker.onmessage = function (event) {
51
Web Workers
<script> var worker = new Worker('worker.js'); worker.onmessage = function (event) { console.log('Results: ' + event.data);
51
Web Workers
<script> var worker = new Worker('worker.js'); worker.onmessage = function (event) { console.log('Results: ' + event.data); };
51
Web Workers
<script> var worker = new Worker('worker.js'); worker.onmessage = function (event) { console.log('Results: ' + event.data); }; </script>
51
worker.js
function findPrimes() { // ... prime algorithm here postMessage(nextPrime); } findPrimes();
52
HTML5 Support
Chrome
canvas/SVG
Firefox
Safari
Opera
video
geolocation
(iPhone)
app cache
(mobile)
database
(mobile)
workers
(mobile)
Download Slides
http://codinginparadise.org/presentations/intro_html5.pdf
54
Introduction to HTML 5
Brad Neuberg Developer Programs, Google