using html5 for a great open web

65
Using HTML5 For a Great Open Web

Upload: robert-nyman

Post on 12-May-2015

3.241 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Using HTML5 for a great Open Web

Using HTML5 For a Great Open Web

Page 2: Using HTML5 for a great Open Web
Page 3: Using HTML5 for a great Open Web
Page 4: Using HTML5 for a great Open Web
Page 5: Using HTML5 for a great Open Web
Page 6: Using HTML5 for a great Open Web
Page 7: Using HTML5 for a great Open Web
Page 8: Using HTML5 for a great Open Web
Page 9: Using HTML5 for a great Open Web
Page 10: Using HTML5 for a great Open Web

Why HTML5?

Page 11: Using HTML5 for a great Open Web

<!DOCTYPE html>

Page 12: Using HTML5 for a great Open Web

<DIV>A monkey</DIV><p id=john>John’s P</p>

<input type=text><input type="text"><input type="text" />

Page 13: Using HTML5 for a great Open Web
Page 14: Using HTML5 for a great Open Web

<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml">

MUST be application/xhtml+xml or application/xml

<noscript>Not in XHTML</noscript>

As XHTML

Page 15: Using HTML5 for a great Open Web

<article>

<video>

<time>

<section><nav>

<hgroup>

<header>

<footer>

<audio>

<aside>

<figcaption>

<figure>

Page 16: Using HTML5 for a great Open Web

<input type="tel">

<input type="search">

<input type="url">

<input type="email">

<input type="datetime">

<input type="date">

<input type="month">

<input type="week">

<input type="time">

<input type="datetime-local">

<input type="number">

<input type="range"><input type="color">

Page 17: Using HTML5 for a great Open Web
Page 18: Using HTML5 for a great Open Web

Web Storage

Page 19: Using HTML5 for a great Open Web
Page 20: Using HTML5 for a great Open Web
Page 21: Using HTML5 for a great Open Web

sessionStorage.setItem("FU", "Sarah Palin");console.log(sessionStorage.getItem("FU"));

Page 22: Using HTML5 for a great Open Web

localStorage.setItem("Job", "Politician");

Page 23: Using HTML5 for a great Open Web

var sarahPalin = { "contest" : "Miss Alaska pageant", "Talent" : "Flute playing"};

localStorage.setItem("sarah", JSON.stringify(sarahPalin));

console.log(typeof JSON.parse(localStorage.getItem("sarah")));

Page 24: Using HTML5 for a great Open Web

Web SQL

IndexedDB

Page 25: Using HTML5 for a great Open Web

Offline Web Applications

Page 26: Using HTML5 for a great Open Web

if (window.addEventListener) { /* Works well in Firefox and Opera with the Work Offline option in the File menu. Pulling the ethernet cable doesn't seem to trigger it */ window.addEventListener("online", isOnline, false); window.addEventListener("offline", isOffline, false);}else { /* Works in IE with the Work Offline option in the File menu and pulling the ethernet cable */ document.body.ononline = isOnline; document.body.onoffline = isOffline;}

Page 27: Using HTML5 for a great Open Web

// Poll the navigator.onLine propertysetInterval(function () { console.log(navigator.onLine);}, 1000);

Page 28: Using HTML5 for a great Open Web

<!DOCTYPE html><html manifest="offline.manifest"><head>...

Page 29: Using HTML5 for a great Open Web

CACHE MANIFEST

# VERSION 10

CACHE:offline.htmlbase.css

FALLBACK:online.css offline.css

NETWORK:/live-updates

Page 30: Using HTML5 for a great Open Web

History API

Page 31: Using HTML5 for a great Open Web

var url = "http://robertnyman.com",title = "My blog",state = { address : url};

window.history.pushState(state.address, title, url);

Page 32: Using HTML5 for a great Open Web

window.history.replaceState(state.address, title, url);

Page 33: Using HTML5 for a great Open Web

Geolocation

Page 34: Using HTML5 for a great Open Web

if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { alert(position.coords.latitude + ", " + position.coords.longitude); }); }

Page 35: Using HTML5 for a great Open Web
Page 36: Using HTML5 for a great Open Web
Page 37: Using HTML5 for a great Open Web

Video

Page 38: Using HTML5 for a great Open Web

<video controls src="nasa.webm"></video>

Page 39: Using HTML5 for a great Open Web

<video controls> <source src="nasa.mp4"></source> <source src="nasa.webm"></source></video>

Page 42: Using HTML5 for a great Open Web

<video src="http://vid.ly/4w2g7d?content=video" controls></video>

Page 43: Using HTML5 for a great Open Web
Page 44: Using HTML5 for a great Open Web

Canvas

Page 46: Using HTML5 for a great Open Web

<canvas id="my-canvas" width="500" height="500"> I am canvas</canvas>

Page 47: Using HTML5 for a great Open Web

var canvas = document.getElementById("my-canvas"), context = canvas.getContext("2d");

context.fillStyle = "#f00";context.fillRect(0, 0, 100, 100);

Page 48: Using HTML5 for a great Open Web

context.save();

context.fillStyle = "rgba(0, 0, 200, 0.5)";context.fillRect(50, 50, 100, 100);

context.clearRect(40, 40, 20, 20);

context.restore();

Page 49: Using HTML5 for a great Open Web
Page 50: Using HTML5 for a great Open Web

HTML5 Canvas for Internet Explorer <= 8

-

explorercanvas

Page 51: Using HTML5 for a great Open Web
Page 53: Using HTML5 for a great Open Web

WebGL

Page 57: Using HTML5 for a great Open Web
Page 58: Using HTML5 for a great Open Web
Page 60: Using HTML5 for a great Open Web
Page 61: Using HTML5 for a great Open Web
Page 62: Using HTML5 for a great Open Web
Page 63: Using HTML5 for a great Open Web
Page 64: Using HTML5 for a great Open Web

Robert Nymanrobertnyman.com/speaking/robertnyman.com/html5/Twitter: @robertnyman

Pictures:

Star Wars Awesome: http://jacobcharlesdietz.com/#/awesome/Robocop: http://www.meh.ro/2010/04/01/murphy-as-robocop/Bruce Willis: http://www.starsjournal.com/3192/bruce-willis-is-being-sued-for-4-million-dollars.htmlSwedish flag: http://www.olssonfoto.se/JAlbum/SGP%202008%20Ullevi/slides/Svenska%20flaggan.htmlEuro Coin: http://accidentaldong.blogspot.com/2009/10/euro-uh-oh.htmlFirefox does good: http://www.flickr.com/photos/intothefuzz/5577418445/in/set-72157626401344080George W Bush fail 1: http://freetraveler.net/pictures/2.09.06/fun/1.jpgGeorge W Bush fail 2: http://blogs.warwick.ac.uk/images/akyrtzoglou/2005/06/07/g2.jpgGeorge W Bush fail 3: http://blogs.warwick.ac.uk/images/akyrtzoglou/2005/06/07/gb3.jpgStorage fail: http://failfun.com/funny-pictures/gangsta-fail/Cookie monster: http://honestviewsfromhonestman.blogspot.com/2009/09/cookie-monster.htmlYou suck: http://www.crunchgear.com/2009/04/22/gadgets-sucks/

Internet hole: http://cheezburger.com/View/3194058752History: http://animatedtv.about.com/od/fgmultimedia/ig/-Family-Guy--Pictures/Griffin-Family-History.htmGeolocation: http://www.datadial.net/blog/index.php/2008/09/22/the-definitive-guide-to-website-geo-location/Canvas: http://www.ioffer.com/c/Drawings-1000407Oriental studies: http://www.swollenpickles.com/2007/01/29/phallic-logo-awards/3D apple: http://3dst.de/typo3temp/pics/974e4144fc.jpgGo where I've never been: http://musicisart.ws/diane-arbus/Anything is possible: http://www.elektrodrop.com/2009/12/straight-out-of-china/?quick_view=1Super Mario Video: http://www.archive.org/details/Mario1_507

Page 65: Using HTML5 for a great Open Web

We can’t change history, but we can change the future.Be nice to each other.