12.08.2012 Views

mobee.in - enabling email on any mobile using SMS

mobee.in - enabling email on any mobile using SMS

mobee.in - enabling email on any mobile using SMS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

An Introducti<strong>on</strong> to<br />

HTML5 & CSS3<br />

Dasharatham Bitla (Dash)<br />

dash@bitlasoft.com | http://weblog.bitlasoft.com<br />

www.BitlaSoft.com


�Browsers Started a Revoluti<strong>on</strong> that C<strong>on</strong>t<str<strong>on</strong>g>in</str<strong>on</strong>g>ues<br />

� In 1995 Netscape <str<strong>on</strong>g>in</str<strong>on</strong>g>troduced JavaScript<br />

� In 1999, Microsoft <str<strong>on</strong>g>in</str<strong>on</strong>g>troduces XMLHTTP<br />

� In 2002, Mozilla 1.0 <str<strong>on</strong>g>in</str<strong>on</strong>g>cludes XMLHttpRequest natively<br />

� ... Then web applicati<strong>on</strong>s started tak<str<strong>on</strong>g>in</str<strong>on</strong>g>g off ...<br />

� In 2004, Gmail launches as a beta<br />

� In 2005, AJAX takes off (e.g. Google Maps)<br />

�Now web applicati<strong>on</strong>s are demand<str<strong>on</strong>g>in</str<strong>on</strong>g>g more<br />

capabilities


HTML5


�Necessary for modern web apps<br />

�Standardizati<strong>on</strong><br />

�Cross-platform<br />

�Apple Safari, Google Chrome, Mozilla Firefox, and<br />

Opera<br />

�Even IE9 will support HTML5<br />

�<strong>mobile</strong> web browsers that come pre-<str<strong>on</strong>g>in</str<strong>on</strong>g>stalled <strong>on</strong><br />

iPh<strong>on</strong>es, iPads, Android ..<br />

�Scribd/YouTube to HTML5<br />

�Apple push<str<strong>on</strong>g>in</str<strong>on</strong>g>g back <strong>on</strong> Flash - why?<br />

�Google Gears no l<strong>on</strong>ger be supported <str<strong>on</strong>g>in</str<strong>on</strong>g>favor of<br />

HTML5


What’s new?


HTML 5 Features<br />

�Client-side Database Storage<br />

�sessi<strong>on</strong>Storage<br />

�Applicati<strong>on</strong> Cache - Offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e<br />

�SQLite <str<strong>on</strong>g>in</str<strong>on</strong>g> browser<br />

�2D Graphics – Canvas/SVG<br />

�Video/Audio<br />

�Geo locati<strong>on</strong><br />

�Speed<br />

�Web Workers<br />

�UI tools<br />

�Forms 2.0


• new structural elements<br />

,,,,...<br />

• new <str<strong>on</strong>g>in</str<strong>on</strong>g>l<str<strong>on</strong>g>in</str<strong>on</strong>g>e elements<br />

• dynamic pages support<br />

• form types<br />

• media elements<br />

,,<br />

• some old elements removed<br />

• getElementsByClassName<br />


• and graphics c<strong>on</strong>text<br />

• local and sessi<strong>on</strong> storage<br />

• web database<br />

• web worker<br />

• websocket<br />

• geolocati<strong>on</strong><br />

• offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e webapplicati<strong>on</strong>s<br />

new Javascript APIs<br />

• Custom c<strong>on</strong>tent handlers, p<str<strong>on</strong>g>in</str<strong>on</strong>g>g attribute, crossdocument<br />

messag<str<strong>on</strong>g>in</str<strong>on</strong>g>g, Audio <str<strong>on</strong>g>in</str<strong>on</strong>g>terface, video element,<br />

Server-sent DOM events, c<strong>on</strong>tenteditable attribute, Drag<br />

& drop, DOMC<strong>on</strong>tentLoaded, Web Workers, Offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e Web<br />

applicati<strong>on</strong>s, MathML, <str<strong>on</strong>g>in</str<strong>on</strong>g>l<str<strong>on</strong>g>in</str<strong>on</strong>g>e SVG, Web Forms 2.0<br />


TAGS


HTML 4.01<br />

web-pages<br />

design<br />

HTML5<br />

web-applicati<strong>on</strong>s<br />

user-<str<strong>on</strong>g>in</str<strong>on</strong>g>terface


Layout/Structure


Web site design


A Simple Web site design


FORMS 2.0


AUDIO/VIDEO


�Allows a page to natively play video<br />

�No plug<str<strong>on</strong>g>in</str<strong>on</strong>g>s required<br />

�As simple as <str<strong>on</strong>g>in</str<strong>on</strong>g>clud<str<strong>on</strong>g>in</str<strong>on</strong>g>g an image - Not<br />

supported<br />

�Has built-<str<strong>on</strong>g>in</str<strong>on</strong>g> playback c<strong>on</strong>trols<br />

�Stop, Pause, Play,<br />

<br />

�Scriptable, <str<strong>on</strong>g>in</str<strong>on</strong>g> case you want your own dynamic<br />

c<strong>on</strong>trol


<br />

<br />

�For different codecs supported by diff browers<br />

<br />

<br />

<br />

…<br />

<br />

�var vid = doc.getByTagname(“video”)[0];<br />

�vid.play();


SVG Tag & CANVAS (API)


�Could not draw <strong>on</strong> the web<br />

�Flash etc was there … but<br />

�Graphics <str<strong>on</strong>g>in</str<strong>on</strong>g>tr<str<strong>on</strong>g>in</str<strong>on</strong>g>sic part of the web<br />

�Embedded <str<strong>on</strong>g>in</str<strong>on</strong>g>to web platform<br />

�HTML<br />

�DOM<br />

�Fits directly <str<strong>on</strong>g>in</str<strong>on</strong>g>to CSS3 and JS scriptable<br />

SVG & Canvas


�HTML like tags for draw<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

�Draw <str<strong>on</strong>g>in</str<strong>on</strong>g>to the page …<br />

�Make it <str<strong>on</strong>g>in</str<strong>on</strong>g>teractive …<br />

�Scale it without <strong>any</strong> distorti<strong>on</strong>/pixelati<strong>on</strong> …<br />

�What can you do with this now???<br />

SVG<br />

<br />


�http://www.mozilla.com/en-US/firefox/stats/<br />

�SVG<br />

� Highlevel<br />

� Import/Export<br />

� Easy Uis<br />

� Intractive<br />

� Medium Animat<str<strong>on</strong>g>in</str<strong>on</strong>g><br />

� Tree of Objects<br />

�Canvas<br />

� Low level<br />

� No mouse <str<strong>on</strong>g>in</str<strong>on</strong>g>teracti<strong>on</strong><br />

� High animati<strong>on</strong><br />

� JS Centric<br />

� More Bookkeep<str<strong>on</strong>g>in</str<strong>on</strong>g>g


�http://code.google.com/p/svgweb/<br />

SVG Demos<br />

�http://cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g<str<strong>on</strong>g>in</str<strong>on</strong>g>paradise.org/projects/svgweb/sampl<br />

es/demo.html<br />

�http://cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g<str<strong>on</strong>g>in</str<strong>on</strong>g>paradise.org/projects/svgweb/sampl<br />

es/javascript-samples/svg_dynamic_fancy.html


�JS API – Scriptable Image API<br />

<br />

<br />

var canvas = document.getElementById(“myCan”);<br />

Vat ctx = canvas.getC<strong>on</strong>text(„2d‟);<br />

ctx.fillStyle=“rgb(200,0,0)”;<br />

ctx.fillRect (10,10,55,50);<br />

ctx.fillStyle=“rgba(200,0,0,0.5)”;<br />

ctx.fillRect (30,30,55,50);<br />

�WebGL based <strong>on</strong> Open GL for 3d c<strong>on</strong>text<br />

Canvas API


� Create a virtual canvas for draw<str<strong>on</strong>g>in</str<strong>on</strong>g>g graphics <str<strong>on</strong>g>in</str<strong>on</strong>g> the browser.<br />

� Javascript can be used to c<strong>on</strong>trol graphic render<str<strong>on</strong>g>in</str<strong>on</strong>g>g via the<br />

canvas.<br />

� x,y coord<str<strong>on</strong>g>in</str<strong>on</strong>g>ate system<br />

html:<br />

<br />

this is displayed when the tag is not supported...<br />

<br />

javascript:<br />

var g = document.getElementById('graph');<br />

if (g && g.getC<strong>on</strong>text) {<br />

var c = g.getC<strong>on</strong>text('2d');<br />

}


ctx.clearRect(0,0,400,400);<br />

var gr =<br />

ctx.createL<str<strong>on</strong>g>in</str<strong>on</strong>g>earGradient(0,200,0,400);<br />

gr.addColorStop(0.5, "#ddd");<br />

gr.addColorStop(1, "green");<br />

ctx.fillStyle = gr;<br />

ctx.fillRect(0,0,400,400);<br />

ctx.beg<str<strong>on</strong>g>in</str<strong>on</strong>g>Path();<br />

ctx.strokeStyle = "#000";<br />

ctx.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eWidth = 0.2;<br />

for (i = 0; i


canvas is a reference to a element<br />

var c<strong>on</strong>text = canvas.getC<strong>on</strong>text('2d');<br />

c<strong>on</strong>text.fillRect(0,0,50,50);<br />

canvas.setAttribute('width', '300'); // clears the canvas<br />

c<strong>on</strong>text.fillRect(0,100,50,50);<br />

canvas.width = canvas.width; // clears the canvas<br />

c<strong>on</strong>text.fillRect(100,0,50,50); // <strong>on</strong>ly this square rema<str<strong>on</strong>g>in</str<strong>on</strong>g>s<br />

(reproduced from http://www.whatwg.org/specs/webapps/currentwork/#<br />

canvas with permissi<strong>on</strong>)<br />


c<strong>on</strong>text.fillStyle = '#00f'; // blue<br />

c<strong>on</strong>text.strokeStyle = '#f00'; // red<br />

c<strong>on</strong>text.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eWidth = 4;<br />

// Draw some rectangles.<br />

c<strong>on</strong>text.fillRect (0, 0, 150, 50);<br />

c<strong>on</strong>text.strokeRect(0, 60, 150, 50);<br />

c<strong>on</strong>text.clearRect (30, 25, 90, 60);<br />

c<strong>on</strong>text.strokeRect(30, 25, 90, 60);<br />

fill, stroke, l<str<strong>on</strong>g>in</str<strong>on</strong>g>es, Rect


Set the style properties.<br />

c<strong>on</strong>text.fillStyle = '#00f';<br />

c<strong>on</strong>text.strokeStyle = '#f00';<br />

c<strong>on</strong>text.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eWidth = 4;<br />

c<strong>on</strong>text.beg<str<strong>on</strong>g>in</str<strong>on</strong>g>Path();<br />

// Start from the top-left po<str<strong>on</strong>g>in</str<strong>on</strong>g>t.<br />

c<strong>on</strong>text.moveTo(10, 10); // give the (x,y)<br />

coord<str<strong>on</strong>g>in</str<strong>on</strong>g>ates<br />

c<strong>on</strong>text.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eTo(100, 10);<br />

c<strong>on</strong>text.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eTo(10, 100);<br />

c<strong>on</strong>text.l<str<strong>on</strong>g>in</str<strong>on</strong>g>eTo(10, 10);<br />

// D<strong>on</strong>e! Now fill the shape, and draw the<br />

stroke.<br />

c<strong>on</strong>text.fill();<br />

c<strong>on</strong>text.stroke();<br />

c<strong>on</strong>text.closePath();<br />

Path


arc(x, y, radius, startAngle, endAngle, anticlockwise)<br />

quadraticCurveTo(cp1x, cp1y, x, y) // (BROKEN <str<strong>on</strong>g>in</str<strong>on</strong>g> FF 3.5)<br />

bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)<br />

Styles and Colors<br />

ctx.fillStyle = "orange";<br />

ctx.fillStyle = "#FFA500";<br />

ctx.fillStyle = "rgb(255,165,0)";<br />

ctx.strokeStyle = "rgba(255,0,0,0.5)";<br />

l<str<strong>on</strong>g>in</str<strong>on</strong>g>eWidth = value<br />

l<str<strong>on</strong>g>in</str<strong>on</strong>g>eCap = type<br />

l<str<strong>on</strong>g>in</str<strong>on</strong>g>eJo<str<strong>on</strong>g>in</str<strong>on</strong>g> = type<br />

miterLimit = value<br />

createL<str<strong>on</strong>g>in</str<strong>on</strong>g>earGradient(x1,y1,x2,y2)<br />

createRadialGradient(x1,y1,r1,x2,y2,r2)<br />

addColorStop(positi<strong>on</strong>, color)<br />

createPattern(image,type)<br />

Arcs, Curves


Images: draw, scale, slice<br />

//drawImage(image, sx, sy, sWidth, sHeight, dx, dy,<br />

dWidth, dHeight)// Draw slice<br />

ctx.drawImage(document.getElementById('source'),<br />

33,71,104,124,21,20,87,104);<br />

// Draw frame<br />

ctx.drawImage(document.getElementById('frame'),<br />

0,0);c<strong>on</strong>text.stroke();c<strong>on</strong>text.closePath();


State: Canvas states are stored <strong>on</strong> a stack<br />

save()<br />

restore()<br />

translate(x, y)<br />

rotate(angle)<br />

scale(x, y)<br />

transform(m11, m12, m21, m22, dx, dy)<br />

setTransform(m11, m12, m21, m22, dx,<br />

dy)<br />

Transformati<strong>on</strong>s<br />

var i = 0;<br />

var s<str<strong>on</strong>g>in</str<strong>on</strong>g> = Math.s<str<strong>on</strong>g>in</str<strong>on</strong>g>(Math.PI/6);<br />

var cos = Math.cos(Math.PI/6);<br />

ctx.translate(200, 200);<br />

var c = 0;<br />

for (i; i


Canvas Demos<br />

http://www.canvasdemos.com/type/applicati<strong>on</strong>s/<br />

http://code.edspencer.net/Bean/<str<strong>on</strong>g>in</str<strong>on</strong>g>dex.html<br />

http://www.xarg.org/project/chrome-experiment/<br />

http://www.canvasdemos.com/2010/05/06/catch-it/


API


Drag and Drop & History API<br />

Provides an API for Drap and Drop for<br />

JavaScript<br />

History API - Access Browser history<br />

via JavaScript.


GEO-LOCATION


�Browsers are now locati<strong>on</strong> enabled<br />

�iPh<strong>on</strong>e, Android leverages it too<br />

Navigator.geolcati<strong>on</strong>.getCurrentPositi<strong>on</strong>(<br />

);<br />

functi<strong>on</strong>(positi<strong>on</strong>) {<br />

}<br />

var lat = positi<strong>on</strong>.,coords.latitude;<br />

var lan = positi<strong>on</strong>.,coords.l<strong>on</strong>giture;<br />

showLocati<strong>on</strong>(lat, lan);<br />

Geo Locati<strong>on</strong>


functi<strong>on</strong> doLocati<strong>on</strong>() {<br />

if (navigati<strong>on</strong>Supported() ) {<br />

navigator.geolocati<strong>on</strong>.getCurrentPositi<strong>on</strong>(<br />

showPositi<strong>on</strong>,<br />

positi<strong>on</strong>Error,<br />

{<br />

enableHighAccuracy:false,<br />

timeout:10000,<br />

maximumAge:300000<br />

}<br />

);<br />

}<br />

}<br />

functi<strong>on</strong> showPositi<strong>on</strong>(positi<strong>on</strong>) {<br />

var lat = positi<strong>on</strong>.coords.latitude;<br />

var l<strong>on</strong> = positi<strong>on</strong>.coords.l<strong>on</strong>gitude;<br />

if (GBrowserIsCompatible()) {<br />

var map = new GMap2(document.getElementById("locati<strong>on</strong>-map"));<br />

var weAreHere = new GLatLng(lat, l<strong>on</strong>);<br />

map.setCenter(weAreHere, 13);<br />

var marker = new GMarker(weAreHere);<br />

map.addOverlay( marker );<br />

marker.b<str<strong>on</strong>g>in</str<strong>on</strong>g>dInfoW<str<strong>on</strong>g>in</str<strong>on</strong>g>dowHtml("You are here");<br />

map.setUIToDefault();<br />

}<br />

}<br />

geolocati<strong>on</strong>


WEB-WORKERS


Native apps have threads and processes<br />

Workers provide web apps with a means for c<strong>on</strong>currency<br />

Can offload heavy computati<strong>on</strong> <strong>on</strong>to a separate thread so<br />

your app doesn’t block<br />

Run JS <str<strong>on</strong>g>in</str<strong>on</strong>g> the background without clogg<str<strong>on</strong>g>in</str<strong>on</strong>g>g the UI threads<br />

Come <str<strong>on</strong>g>in</str<strong>on</strong>g> 3 flavors<br />

– Dedicated (th<str<strong>on</strong>g>in</str<strong>on</strong>g>k: bound to a s<str<strong>on</strong>g>in</str<strong>on</strong>g>gle tab)<br />

– Shared (shared am<strong>on</strong>g multiple w<str<strong>on</strong>g>in</str<strong>on</strong>g>dows <str<strong>on</strong>g>in</str<strong>on</strong>g> an orig<str<strong>on</strong>g>in</str<strong>on</strong>g>)<br />

– Persistent (run when the browser is “closed”)


WEB Sockets<br />

Allows bi-directi<strong>on</strong>al communicati<strong>on</strong> between<br />

client and server <str<strong>on</strong>g>in</str<strong>on</strong>g> a cleaner, more efficient<br />

form than hang<str<strong>on</strong>g>in</str<strong>on</strong>g>g gets (or a series of<br />

XMLHttpRequests)<br />

Specificati<strong>on</strong> is under active development


OFFLINE


Applicati<strong>on</strong> Cache<br />

�Applicati<strong>on</strong> cache solves the problem of how to<br />

make it such that <strong>on</strong>e can load an applicati<strong>on</strong> URL<br />

while offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e and it just works<br />

�Web pages can provide a manifest of files that<br />

should be cached locally<br />

�These pages can be accessed offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e<br />

�Enables web pages to work without the user be<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

c<strong>on</strong>nected to the Internet<br />

�Database and app cache store together can do a<br />

great job<br />

�Go<str<strong>on</strong>g>in</str<strong>on</strong>g>g Offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e <str<strong>on</strong>g>in</str<strong>on</strong>g> Gmail – what happens?<br />

�Gmail <strong>on</strong> iPh<strong>on</strong>e – how it works?<br />

�Google stopped support<str<strong>on</strong>g>in</str<strong>on</strong>g>g Gears <str<strong>on</strong>g>in</str<strong>on</strong>g> favor of HTML5


Manifest sample c<strong>on</strong>tents:<br />

CACHE MANIFEST<br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>dex.html<br />

c<strong>on</strong>tents.html<br />

applicati<strong>on</strong>.js<br />

image.jpg<br />

# force <strong>on</strong>l<str<strong>on</strong>g>in</str<strong>on</strong>g>e:<br />

NETWORK:<br />

<strong>on</strong>l<str<strong>on</strong>g>in</str<strong>on</strong>g>e-logo.png<br />

# provide fallback<br />

FALLBACK:<br />

images/ images/fallback-image.png<br />

offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e webapplicati<strong>on</strong>


STORAGE


�Provides a way to store data client side<br />

Local Storage<br />

�Useful for m<strong>any</strong> classes of applicati<strong>on</strong>s, especially <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

c<strong>on</strong>juncti<strong>on</strong> with offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e capabilities<br />

�2 ma<str<strong>on</strong>g>in</str<strong>on</strong>g> APIs provided: a database API (expos<str<strong>on</strong>g>in</str<strong>on</strong>g>g a SQLite<br />

database) and a structured storage api (key/value pairs)<br />

db.transacti<strong>on</strong>(functi<strong>on</strong>(tx) {<br />

tx.executeSql('SELECT * FROM MyTable', [],<br />

functi<strong>on</strong>(tx, rs) {<br />

for (var i = 0; i < rs.rows.length; ++i) {<br />

var row = rs.rows.item(i);<br />

DoSometh<str<strong>on</strong>g>in</str<strong>on</strong>g>g(row['column']);<br />

}<br />

});<br />

});


localStorage / sessi<strong>on</strong>Storage<br />

// visible to all w<str<strong>on</strong>g>in</str<strong>on</strong>g>dows loaded from same locati<strong>on</strong><br />

localStorage.setItem('currency','EUR');<br />

var currency = localStorage.getItem('currency');<br />

// stored <str<strong>on</strong>g>in</str<strong>on</strong>g> w<str<strong>on</strong>g>in</str<strong>on</strong>g>dow object, deleted <strong>on</strong> close<br />

sessi<strong>on</strong>Storage.setItem('currency','EUR');<br />

var currency = sessi<strong>on</strong>Storage.getItem('currency');


web database<br />

$(document).ready(functi<strong>on</strong>() {<br />

var shortName = "Shopp<str<strong>on</strong>g>in</str<strong>on</strong>g>g";<br />

var versi<strong>on</strong> = "1.0";<br />

var displayName = "Shopp<str<strong>on</strong>g>in</str<strong>on</strong>g>g";<br />

var maxSize = 65536; // <str<strong>on</strong>g>in</str<strong>on</strong>g> kilobytes<br />

db = openDatabase(shortName, versi<strong>on</strong>, displayName, maxSize);<br />

db.transacti<strong>on</strong>(<br />

functi<strong>on</strong>(transacti<strong>on</strong>) {<br />

transacti<strong>on</strong>.executeSql(<br />

'create table if not exists entries ' +<br />

'(id <str<strong>on</strong>g>in</str<strong>on</strong>g>teger not null primary key auto<str<strong>on</strong>g>in</str<strong>on</strong>g>crement, ' +<br />

' name text not null, row <str<strong>on</strong>g>in</str<strong>on</strong>g>teger not null, secti<strong>on</strong><br />

<str<strong>on</strong>g>in</str<strong>on</strong>g>teger not null);'<br />

);<br />

}<br />

);<br />

});


web database<br />

functi<strong>on</strong> addarticle() {<br />

var article = $('#article').val();<br />

var row = $('#row').val();<br />

var secti<strong>on</strong> = $('#secti<strong>on</strong>').val();<br />

db.transacti<strong>on</strong>(<br />

functi<strong>on</strong>(transacti<strong>on</strong>) {<br />

transacti<strong>on</strong>.executeSql(<br />

'<str<strong>on</strong>g>in</str<strong>on</strong>g>sert <str<strong>on</strong>g>in</str<strong>on</strong>g>to entries(name,row,secti<strong>on</strong>) values(?,?,?);',<br />

[article, row, secti<strong>on</strong>],<br />

functi<strong>on</strong>() {<br />

refreshEntries();<br />

jQT.goBack();<br />

},<br />

errorHandler<br />

);<br />

}<br />

);<br />

$('#articleform')[0].reset();<br />

return false;<br />

}<br />

functi<strong>on</strong> errorHandler(transacti<strong>on</strong>, error) {<br />

alert('Sorry, save failed - ' + error.message + '(code:' + error.code +')');<br />

// return<str<strong>on</strong>g>in</str<strong>on</strong>g>g true halts executi<strong>on</strong> and rolls back<br />

return true;<br />

}


�Cleaner markup<br />

What are the benefits of us<str<strong>on</strong>g>in</str<strong>on</strong>g>g HTML5<br />

�Additi<strong>on</strong>al semantics of new elements like ,<br />

, and <br />

�make it a lot easier for search eng<str<strong>on</strong>g>in</str<strong>on</strong>g>es and<br />

screenreaders to navigate our pages, and improve the<br />

web experience for every<strong>on</strong>e<br />

�New form <str<strong>on</strong>g>in</str<strong>on</strong>g>put types and attributes that will (and <str<strong>on</strong>g>in</str<strong>on</strong>g><br />

Opera‟s case, do) take the hassle out of script<str<strong>on</strong>g>in</str<strong>on</strong>g>g forms<br />

�Stay<str<strong>on</strong>g>in</str<strong>on</strong>g>g ahead of the curve before HTML5 becomes the<br />

ma<str<strong>on</strong>g>in</str<strong>on</strong>g>stream markup language. Use this as a sell<str<strong>on</strong>g>in</str<strong>on</strong>g>g po<str<strong>on</strong>g>in</str<strong>on</strong>g>t<br />

when talk<str<strong>on</strong>g>in</str<strong>on</strong>g>g with your clients<br />

�HTML5 and iPh<strong>on</strong>e/smartph<strong>on</strong>e (apps without C)<br />

– Ph<strong>on</strong>eGap, Rhodes, Titanium


What are the downsides to us<str<strong>on</strong>g>in</str<strong>on</strong>g>g HTML5<br />

�The spec isn’t f<str<strong>on</strong>g>in</str<strong>on</strong>g>ished and is likely to change<br />

�Not everyth<str<strong>on</strong>g>in</str<strong>on</strong>g>g works <str<strong>on</strong>g>in</str<strong>on</strong>g> every browser (but you could<br />

say the same about CSS, right?<br />

the good news is<br />

�<str<strong>on</strong>g>in</str<strong>on</strong>g> the <strong>mobile</strong> world, the situati<strong>on</strong> is much better<br />

�iPh<strong>on</strong>e, Android use WebKit based browsers<br />

�supports offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e web app, web database, canvas,<br />

geolocati<strong>on</strong>, ...


can I use ... ?<br />

support still <str<strong>on</strong>g>in</str<strong>on</strong>g>complete across browsers<br />

IE9 promise to offer full support<br />

for some features, javascript workaround available:<br />

• canvas : excanvas.js gives support <str<strong>on</strong>g>in</str<strong>on</strong>g> IE (all versi<strong>on</strong>s)<br />

can be used today<br />

• HTML5 elements: html5shiv<br />

fixes DOM tree and adds styl<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

check<br />

http://caniuse.com<br />

(am<strong>on</strong>g others)


Use feature detecti<strong>on</strong>, not browser detecti<strong>on</strong><br />

can I use ... ?<br />

Modernizr (http://www.modernizr.com/) creates a global object<br />

that you can check:<br />

if (Modernizr.video) {<br />

// video element is supported<br />

} else {<br />

// fall back<br />

}


�Us<str<strong>on</strong>g>in</str<strong>on</strong>g>g Modernizr - http://www.modernizr.com/<br />

� <br />

� <br />

� <br />

� <br />

� Dive Into HTML5<br />

� <br />

� <br />

� <br />

� ...<br />

� <br />

� <br />

� if (Modernizr.canvas) {<br />

� // let's draw some shapes!<br />

� } else {<br />

� // no native canvas support available :(<br />

� }<br />

Detect<str<strong>on</strong>g>in</str<strong>on</strong>g>g


SmartPh<strong>on</strong>e<br />

Apps us<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

HTML5 & CSS3


jQuery plug<str<strong>on</strong>g>in</str<strong>on</strong>g><br />

adds iPh<strong>on</strong>e styl<str<strong>on</strong>g>in</str<strong>on</strong>g>g<br />

adds transiti<strong>on</strong>s us<str<strong>on</strong>g>in</str<strong>on</strong>g>g CSS3 support<br />

<br />

<br />

<br />

var jQT = $.jQTouch({<br />

ic<strong>on</strong>: 'logo.png',<br />

statusBar: 'black'<br />

});<br />

<br />

jQtouch<br />

http://jqtouch.com/preview/demos/ma<str<strong>on</strong>g>in</str<strong>on</strong>g>/ DEMO


jQtouch page structure<br />

<br />

<br />

<br />

RaboTransAct<br />

About<br />

<br />

<br />

Geolocati<strong>on</strong> demo<br />

Informati<strong>on</strong><br />

<br />

<br />

<br />

<br />

Geolocati<strong>on</strong><br />

Back<br />

<br />

Try<str<strong>on</strong>g>in</str<strong>on</strong>g>g to determ<str<strong>on</strong>g>in</str<strong>on</strong>g>e locati<strong>on</strong>...<br />

<br />

<br />

<br />

<br />

Geolocati<strong>on</strong><br />

Back<br />

Run demo<br />

<br />

About geolocati<strong>on</strong>


This can now:<br />

- launch from home screen (as web clip)<br />

- run fullscreen <strong>on</strong> ph<strong>on</strong>e<br />

- store data locally<br />

- run offl<str<strong>on</strong>g>in</str<strong>on</strong>g>e<br />

But can not:<br />

- access hardware (sound, vibrate)<br />

- be submitted to app store<br />

preview <strong>on</strong> desktop


- compiles to native app for iPh<strong>on</strong>e, Android, Blackberry<br />

- abstracts away native API differences<br />

- need SDK for each target device<br />

- open source (MIT license)<br />

- navigator.notificati<strong>on</strong>.vibrate() , .beep(), .alert()<br />

Ph<strong>on</strong>eGap


http://mobilog.bitlasoft.com/ - READ more here ...<br />

Rhodes


�low barrier to entry for <strong>mobile</strong><br />

�familiar language HTML,CSS and JS<br />

C<strong>on</strong>clusi<strong>on</strong>s<br />

�use canvas / excanvas for graphs (no Flash needed)<br />

�Ph<strong>on</strong>eGap (and others) for cross-platform<br />

development<br />

�Rhodes if you are a Ruby Geek<br />

�some of this can be used now


Lets see few quick<br />

DEMOs


�http://www.designzzz.com/html-5-tutorial.html<br />

�http://apirocks.com/html5/html5.html<br />

�http://jqtouch.com/preview/demos/ma<str<strong>on</strong>g>in</str<strong>on</strong>g>/<br />

�http://www.canvasdemos.com/<br />

Demos<br />

�http://cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g<str<strong>on</strong>g>in</str<strong>on</strong>g>paradise.org/projects/svgweb/sa<br />

mples/demo.html<br />

�http://cod<str<strong>on</strong>g>in</str<strong>on</strong>g>g<str<strong>on</strong>g>in</str<strong>on</strong>g>paradise.org/projects/svgweb/sa<br />

mples/javascriptsamples/svg_dynamic_fancy.html


CSS3


�border-radius - Rounded Corners<br />

�border-colors - Gradient Borders<br />

�box-shadow - Drop Shadows<br />

�text-shadow - Text Drop Shadows<br />

�gradient - Gradient backgrounds<br />

�resize - Resize an Element<br />

�background-size - resize background<br />

�background - supports multipe images<br />

New Styles


Selectors<br />

�A Variety of Selectors provide an <str<strong>on</strong>g>in</str<strong>on</strong>g>terface to apply<br />

styles more precisely.<br />

�getElementByClassName<br />

�An example would be select<str<strong>on</strong>g>in</str<strong>on</strong>g>g an nth child.<br />

�Example: div:nth-child(3) {}<br />

�Columns<br />

�Multi Column Layout is now provided by CSS3


Animati<strong>on</strong> and Moti<strong>on</strong><br />

�Animati<strong>on</strong>s - CSS3 allows for animati<strong>on</strong>s of styles<br />

�Transiti<strong>on</strong>s - Allows styles to change gradually color<br />

shifts<br />

�Transformati<strong>on</strong>s - 2D and 3D transformati<strong>on</strong>s,<br />

stretch, move, etc


�HSL – hsl(hue, saturati<strong>on</strong>, lightness)<br />

New color formats <str<strong>on</strong>g>in</str<strong>on</strong>g> CSS3<br />

�CMYK – cmyk(cyan, magenta, yellow, black)<br />

�HSLA – hsl(hue, saturati<strong>on</strong>, lightness, alpha)<br />

�RGBA – rgba(red, green, blue, alpha)


� HTML 5 Doctor - http://html5doctor.com/<br />

More Resources<br />

� HTML 5 Spec - http://dev.w3.org/html5/spec/Overview.html<br />

� http://apirocks.com/html5/html5.html<br />

� http://jqtouch.com/preview/demos/ma<str<strong>on</strong>g>in</str<strong>on</strong>g>/<br />

� http://www.w3schools.com/svg/<br />

� http://www.canvasdemos.com/<br />

� http://motyar.blogspot.com/2010/04/draw<str<strong>on</strong>g>in</str<strong>on</strong>g>g-<strong>on</strong>-web-with-canvasand-jquery.html<br />

� http://code.google.com/p/svgweb/<br />


Questi<strong>on</strong>s?<br />

Dasharatham Bitla (Dash)<br />

Founder & CEO, BitlaSoft<br />

dash@bitlasoft.com | www.BitlaSoft.com<br />

http://weblog.bitlasoft.com | http://mobilog.bitlasoft.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!