advanced web technologies 13

24
Advanced Web Advanced Web Technologies Technologies Lecture # 13 By: Faraz Ahmed

Upload: szabist

Post on 18-Feb-2017

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Advanced Web Technologies 13

Advanced Web Advanced Web TechnologiesTechnologies

Lecture # 13By: Faraz Ahmed

Page 2: Advanced Web Technologies 13

Contents

0Quiz #2

0HTML5

Page 3: Advanced Web Technologies 13

Quiz #2

0What is the use of Doctypes in web pages?

0Draw the Semantic stack.

0What does OWL stand for?

0Briefly describe the layers upto and including the OWL.

Page 4: Advanced Web Technologies 13

Throw nothing away!!

0HTML5 is backward compatible!

Page 5: Advanced Web Technologies 13

Simple beginning

<!DOCTYPE html>

Content-Type also known as MIME-Types Everything has its own MIME-types

XHTML is indicated by its own MIME-type

Page 6: Advanced Web Technologies 13

0Since XHTML is not widely adopted, it was a failed experiment.

0Only XHTML 1.0 was used widely and that too because of a loophole.

Page 7: Advanced Web Technologies 13

HTML5

0What is DOM?

0HTML5 is just an extension of HTML containing some new features.

0To check whether you have a browser supporting those features, just create a feature and run it!

Page 8: Advanced Web Technologies 13

Modernizer

0 It is an HTML5 detection library (javascript).

0 Just include it and use its properties.

0You can use it to check in if….else statements and work accordingly

Page 9: Advanced Web Technologies 13

Canvas

0Used by artists to draw stuff

0A rectangular space where stuff can be drawn on a page and an API to go along with it.

0Since canvas text functions were added later, you need a separate API for this.

0You can use Modernizr.canvastext to check whether you have this support.

Page 10: Advanced Web Technologies 13

Videos

0Embedding videos required using third party tools.

0You can identify multiply video formats and depending on any that are available on the client, they would run.

0You can use Modernizer.video to check whether your browser contains video tag support

Page 11: Advanced Web Technologies 13

Videos

var v = document.createElement("video");

return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');

0 It resturns “Probably”, “Maybe” or “”

0You can use the Modernizer.video.ogg (for ogg codec) to check for versions.

Page 12: Advanced Web Technologies 13

LocalStorage

0Similar to cookies.

0But you can store larger amounts of data.

0Use Modernizr.localstorage to detect local storage.

0How safe is it? Anyone can read it from your PC but only websites that created it can access it. This is known as same-origin restriction

Page 13: Advanced Web Technologies 13

Web Workers

0Allow you to create multiple ‘Threads’

0Use Modernizr.webworkers to detect them.

Page 14: Advanced Web Technologies 13

Some code!

Main.html

doWork.js

Page 15: Advanced Web Technologies 13

Offline Web Applications

0Now everyone can create GMAIL!

0They are initially online, the browser downloads all the relevant offline files and when the user revisits, it uses those downloaded files.

0Use Modernizr.applicationcache to detect it.

Page 16: Advanced Web Technologies 13

Offline Web Applications

0You just need to declare this element <html manifest="manifest.cache"> 

0This contains the rules of caching

Page 17: Advanced Web Technologies 13

A sample rule file!

Page 18: Advanced Web Technologies 13

Rule file cracked!

0The cache manifest has three section headers:0 CACHE

0These files are cached

0 NETWORK0These are white-listed

0 FALLBACK0Backup strategy. If those files do not find an active

connection, use these instead.

Page 19: Advanced Web Technologies 13

GEOLocation

0Figuring out where you are.0 Your IP0 Your connection0 Cell tower you are connected to0 Dedicated GPS hardware

0Use Modernizr.geolocation for this feature

0 comes with an API

Page 20: Advanced Web Technologies 13

More Input Types!0 <input type="search"> for search boxes0 <input type="number"> for spinboxes0 <input type="range"> for sliders0 <input type="color"> for color pickers0 <input type="tel"> for telephone numbers0 <input type="url"> for web addresses0 <input type="email"> for email addresses0 <input type="date"> for calendar date pickers0 <input type="month"> for months0 <input type="week"> for weeks0 <input type="time"> for timestamps0 <input type="datetime"> for precise, absolute date+time stamps0 <input type="datetime-local"> for local dates and times

Page 21: Advanced Web Technologies 13

Input Types

0Use Modernizr.inputtypes.date to check for dates for example

Page 22: Advanced Web Technologies 13

Place Holder Texts

0Placed inside an input field while it is out of focus.

0Use Modernizr.input.placeholder to detect this

Page 23: Advanced Web Technologies 13

Microdata

0Sort of a meta-data about particular parts of html.

0For example declaring a photo under a specific license

0No function in modernizer.

Page 24: Advanced Web Technologies 13

References

[1] “Dive into HTML5”, http://diveintohtml5.org/past.html, visited on 4/5/2011

[2] “Web Workers”. http://www.html5rocks.com/tutorials/workers/basics/, visited on 4/5/2011