SlideShare a Scribd company logo
Few HTML5 APIs You Didn’t Know ExistedFew HTML5 APIs You Didn’t Know Existed
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
The awesome Fullscreen API allows developers
to programmatically launch the browser
into fullscreen mode, pending user approval:
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
// Launch fullscreen for browsers that support it!
launchFullScreen(document.documentElement);
// the whole page
launchFullScreen(document.getElementById("videoE
lement")); // any individual element
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
The getUserMedia API is incredibly interesting; this
API provides access to device media, like your
MacBook's camera! Using this API, the <video> tag,
and canvas, you can take beautiful photos within your
browser!
var video = document.getElementById("video");
// Put video listeners into place
if(navigator.getUserMedia) { // Standard
navigator.getUserMedia({video: “true”},
function(stream) {
video.src = stream;
video.play();
}, errBack);
} else if(navigator.webkitGetUserMedia) { // WebKit-
prefixed
navigator.webkitGetUserMedia(videoObj,
function(stream){
video.src =
window.webkitURL.createObjectURL(stream);
video.play();
}, errBack);
}
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
This simple API provides you information about the
battery's current charge level, its charging status, and
allows you to be notified of changes via a few events.
Let's check it out!
navigator.getBattery().then(function(result) {
console.log(result);
// result:
BatteryManagery {
charging: false,
chargingTime: Infinity,
dischargingTime: 8940,
level: 0.59,
onchargingchange: null,
onchargingtimechange: null,
ondischargingtimechange: null,
onlevelchange: null
}
});
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
Firefox introduces a new strategy for website
optimization: link prefetching.
Link prefetching is a browser mechanism, which
utilizes browser idle time to download or prefetch
documents that the user might visit in the near future. A
web page provides a set of prefetching hints to the
browser, and after the browser is finished loading the
page, it begins silently prefetching specified documents
and stores them in its cache. When the user visits one
of the prefetched documents, it can be served up
quickly out of the browser's cache
<!-- full page -->
<link rel="prefetch"
href="http://burnigroads.ro/race.php" />
<!-- just an image -->
<link rel="prefetch"
href="http://burningroads.ro/imagenec/cars/logan.png
" />
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
Mathematical Markup Language (MathML) is an dialect
of XML for describing mathematical notation and
capturing both its structure and content. Here you'll find
links to documentation, examples, and tools to help
you work with this powerful technology
Use:
<math><msub><msup>...
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
WebSockets is an advanced technology that makes it
possible to open an interactive communication session
between the user's browser and a server. With this
API, you can send messages to a server and receive
event-driven responses without having to poll the
server for a reply.
WebSocket WebSocket(
in DOMString url,
in optional DOMString protocols
);
void close(in optional unsigned long code, in optional
DOMString reason);
void send(in DOMString data);
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
WebRTC (where RTC stands for Real-Time
Communications) is a technology that enables
audio/video streaming and data sharing between
browser clients (peers). As a set of standards,
WebRTC provides any browser with the ability to share
application data and perform teleconferencing peer to
peer, without the need to install plug-ins or third-party
software
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
IndexedDB is a low-level API for client-side storage of
significant amounts of structured data, including
files/blobs. This API uses indexes to enable high
performance searches of this data. While DOM
Storage is useful for storing smaller amounts of data, it
is less useful for storing larger amounts of structured
data. IndexedDB provides a solution.
// Let us open our database
var request =
window.indexedDB.open("MyTestDatabase", 3);
request.onsuccess = function(event) {
db = event.target.result;
// Create an objectStore for this database
var objectStore = db.createObjectStore("name",
{ keyPath: "myKey" });
};
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
WebGL (Web Graphics Library) is a JavaScript API for
rendering interactive 3D and 2D graphics within any
compatible web browser without the use of plug-ins.
WebGL does so by introducing an API that closely
conforms to OpenGL ES 2.0 that can be used in
HTML5 <canvas> elements.
var gl; // A global variable for the WebGL context
function start() {
var canvas =
document.getElementById("glcanvas");
// Initialize the GL context
gl = initWebGL(canvas);
if (gl) {
// Set clear color to black, fully opaque
gl.clearColor(0.0, 0.0, 0.0, 1.0);
// Enable depth testing
gl.enable(gl.DEPTH_TEST);
// Near things obscure far things
gl.depthFunc(gl.LEQUAL);
// Clear the color as well as the depth buffer.
gl.clear(gl.COLOR_BUFFER_BIT |
gl.DEPTH_BUFFER_BIT);
}
}
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
In HTML5 any element can be editable. Using some
JavaScript event handlers you can transform your web
page into a full and fast rich-text editor. This article
provides some information about this functionality.
<!DOCTYPE html>
<html>
<body>
<div contentEditable="true">
This text can be edited by the user.
</div>
</body>
</html>
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
Web Workers provide a simple means for web content
to run scripts in background threads. The worker
thread can perform tasks without interfering with the
user interface. In addition, they can perform I/O using
XMLHttpRequest (although the responseXML and
channel attributes are always null). Once created, a
worker can send messages to the JavaScript code that
created it by posting messages to an event handler
specified by that code (and vice versa.)
var myWorker = new Worker("worker.js");
x.onchange = function() {
myWorker.postMessage([first.value,second.value]);
console.log('Message posted to worker');
}
myWorker.onmessage = function(e) {
result.textContent = e.data;
console.log('Message received from worker');
}
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
The DOM window object provides access to the
browser's history through the history object. It exposes
useful methods and properties that let you move back
and forth through the user's history, as well as --
starting with HTML5 -- manipulate the contents of the
history stack.
window.history.back();
window.history.forward();
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
In order to build a good offline-capable web application,
you need to know when your application is actually
offline. Incidentally, you also need to know when your
application has returned to an 'online' status again.
You need to know when the user comes back online,
so that you can re-synchronize with the server.
You need to know when the user is offline, so that you
can be sure to queue your server requests for a later
time.
function updateOnlineStatus(event) {
var condition = navigator.onLine ? "online" :
"offline";
status.className = condition;
status.innerHTML = condition.toUpperCase();
log.insertAdjacentHTML("beforeend", "Event: " +
event.type + "; Status: " + condition);
}
window.addEventListener('online',
updateOnlineStatus);
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
The Pointer Lock API (formerly called Mouse Lock API)
provides input methods based on the movement of the
mouse over time (i.e., deltas), not just the absolute
position of the mouse cursor in the viewport. It gives
you access to raw mouse movement, locks the target
of mouse events to a single element, eliminates limits
on how far mouse movement can go in a single
direction, and removes the cursor from view.
canvas.requestPointerLock =
canvas.requestPointerLock ||
canvas.mozRequestPointerLock;
canvas.requestPointerLock()
if(document.pointerLockElement === canvas ||
document.mozPointerLockElement === canvas) {
console.log('The pointer lock status is now
locked');
} else {
console.log('The pointer lock status is now
unlocked');
}
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
The geolocation API allows the user to provide their
location to web applications if they so desire. For
privacy reasons, the user is asked for permission to
report location information.
if ("geolocation" in navigator) {
/* geolocation is available */
} else {
/* geolocation IS NOT available */
}
navigator.geolocation.getCurrentPosition(function(po
sition) {
do_something(position.coords.latitude,
position.coords.longitude);
});
var watchID =
navigator.geolocation.watchPosition(function(position
) {
do_something(position.coords.latitude,
position.coords.longitude);
});
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
It is now possible to put a shadow to a box, using box-
shadow and multiple backgrounds can be set.
.multi_bg_example {
width: 100%;
height: 400px;
background-image:
url(https://mdn.mozillademos.org/files/11305/firefox.p
ng),
url(https://mdn.mozillademos.org/files/11307/bubbles
.png), linear-gradient(to right, rgba(30, 75, 115, 1),
rgba(255, 255, 255, 0));
background-repeat: no-repeat, no-repeat, no-
repeat;
background-position: bottom right, left, right;
background: -moz-linear-gradient(to right, rgba(30,
75, 115, 1), rgba(255, 255, 255, 0)), -webkit-
gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255,
255, 0)), -ms-linear-gradient(to right, rgba(30, 75,
115, 1), rgba(255, 255, 255, 0)), linear-gradient(to
right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0));
}
Few HTML5 APIs You Didn’t Know Existed
Fullscreen API
getUserMedia API
Battery API
Link Prefetch
MathML element
WebSockets
WebRTC
IndexedDB
WebGL
Web Workers
History API
The contentEditable Attribute
Pointer Lock API
Online and offline events
Using geolocation
New background styling
Detecting device orientation
Increasingly, web-enabled devices are capable of
determining their orientation; that is, they can report
data indicating changes to their orientation with relation
to the pull of gravity. In particular, hand-held devices
such as mobile phones can use this information to
automatically rotate the display to remain upright,
presenting a wide-screen view of the web content
when the device is rotated so that its width is greater
than its height.
window.addEventListener("deviceorientation",
handleOrientation, true);
function handleOrientation(event) {
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
// Do stuff with the new orientation data
}
Few HTML5 APIs You Didn’t Know ExistedFew HTML5 APIs You Didn’t Know Existed
Dragos Ionita
Software Engineer
https://ro.linkedin.com/in/dragos-ionita-8ab20756
Thanks for watching!Thanks for watching!

More Related Content

What's hot

Csphtp1 20
Csphtp1 20Csphtp1 20
Csphtp1 20
HUST
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
Ivano Malavolta
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
James Pearce
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
Christian Baranowski
 
Fast mobile web apps
Fast mobile web appsFast mobile web apps
Fast mobile web apps
Ivano Malavolta
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
Ivano Malavolta
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
Raul Jimenez
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Colin Su
 
GWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformGWT + Gears : The browser is the platform
GWT + Gears : The browser is the platform
Didier Girard
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
Harshdeep Kaur
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff NorrisRESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
mfrancis
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
Sunil Yadav
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-Side
Reza Rahman
 
Developing Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsDeveloping Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsGR8Conf
 
The current status of html5 technology and standard
The current status of html5 technology and standardThe current status of html5 technology and standard
The current status of html5 technology and standard
Wonsuk Lee
 
AngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroesAngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroes
Vincenzo Ferrari
 
Containerizing ContentBox CMS
Containerizing ContentBox CMSContainerizing ContentBox CMS
Containerizing ContentBox CMS
Gavin Pickin
 

What's hot (20)

Csphtp1 20
Csphtp1 20Csphtp1 20
Csphtp1 20
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
 
Fast mobile web apps
Fast mobile web appsFast mobile web apps
Fast mobile web apps
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
 
Introduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API DevelopmentIntroduction to Google Cloud Endpoints: Speed Up Your API Development
Introduction to Google Cloud Endpoints: Speed Up Your API Development
 
GWT + Gears : The browser is the platform
GWT + Gears : The browser is the platformGWT + Gears : The browser is the platform
GWT + Gears : The browser is the platform
 
intoduction to Grails Framework
intoduction to Grails Frameworkintoduction to Grails Framework
intoduction to Grails Framework
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff NorrisRESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
 
Gwt session
Gwt sessionGwt session
Gwt session
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-Side
 
Developing Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsDeveloping Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with Grails
 
The current status of html5 technology and standard
The current status of html5 technology and standardThe current status of html5 technology and standard
The current status of html5 technology and standard
 
AngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroesAngularJS - Javascript framework for superheroes
AngularJS - Javascript framework for superheroes
 
Containerizing ContentBox CMS
Containerizing ContentBox CMSContainerizing ContentBox CMS
Containerizing ContentBox CMS
 

Similar to Html5 - Awesome APIs

Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
Commit University
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
Sandeep Tol
 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile apps
Ivano Malavolta
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
Susan Winters
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
Mahbubur Rahman
 
Open Source Web Technologies
Open Source Web TechnologiesOpen Source Web Technologies
Open Source Web Technologies
Aastha Sethi
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Gil Fink
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
Yan Shi
 
Web app and more
Web app and moreWeb app and more
Web app and morefaming su
 
Meego Widget Development using Qt WRT @iRajLal
Meego Widget Development using Qt WRT @iRajLalMeego Widget Development using Qt WRT @iRajLal
Meego Widget Development using Qt WRT @iRajLal
Raj Lal
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
Francesco Fullone
 
Always on! ... or not?
Always on! ... or not?Always on! ... or not?
Always on! ... or not?
Carsten Sandtner
 
Creating Rajanikant Powered Site
Creating Rajanikant Powered SiteCreating Rajanikant Powered Site
Creating Rajanikant Powered Site
markandey
 
HTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi LHTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi L
SPRITLE SOFTWARE PRIVATE LIMIT ED
 
Chrome & Webkit overview
Chrome & Webkit overviewChrome & Webkit overview
Chrome & Webkit overview
Bin Chen
 
Mobile Web
Mobile WebMobile Web
Mobile Web
Ankit Maheshwari
 
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
Stfalcon Meetups
 
Frontend. Global domination.
Frontend. Global domination.Frontend. Global domination.
Frontend. Global domination.
Андрей Вандакуров
 

Similar to Html5 - Awesome APIs (20)

Introduction to html5
Introduction to html5Introduction to html5
Introduction to html5
 
Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
 
Html5
Html5Html5
Html5
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile apps
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
 
Open Source Web Technologies
Open Source Web TechnologiesOpen Source Web Technologies
Open Source Web Technologies
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Meego Widget Development using Qt WRT @iRajLal
Meego Widget Development using Qt WRT @iRajLalMeego Widget Development using Qt WRT @iRajLal
Meego Widget Development using Qt WRT @iRajLal
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
 
Always on! ... or not?
Always on! ... or not?Always on! ... or not?
Always on! ... or not?
 
Creating Rajanikant Powered Site
Creating Rajanikant Powered SiteCreating Rajanikant Powered Site
Creating Rajanikant Powered Site
 
HTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi LHTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi L
 
Chrome & Webkit overview
Chrome & Webkit overviewChrome & Webkit overview
Chrome & Webkit overview
 
Mobile Web
Mobile WebMobile Web
Mobile Web
 
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
 
Frontend. Global domination.
Frontend. Global domination.Frontend. Global domination.
Frontend. Global domination.
 

More from Dragos Ionita

Reactive programming - Observable
Reactive programming - ObservableReactive programming - Observable
Reactive programming - Observable
Dragos Ionita
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2
Dragos Ionita
 
The new way to write a frontend software
The new way to write a frontend softwareThe new way to write a frontend software
The new way to write a frontend software
Dragos Ionita
 
Robotics and Arduino (Arduino UNO)
Robotics and Arduino (Arduino UNO)Robotics and Arduino (Arduino UNO)
Robotics and Arduino (Arduino UNO)
Dragos Ionita
 
Hybrid Mobile Application with Ionic Framework
Hybrid Mobile Application with Ionic FrameworkHybrid Mobile Application with Ionic Framework
Hybrid Mobile Application with Ionic Framework
Dragos Ionita
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best Practices
Dragos Ionita
 
Google Tag Manager (GTM)
Google Tag Manager (GTM)Google Tag Manager (GTM)
Google Tag Manager (GTM)
Dragos Ionita
 

More from Dragos Ionita (7)

Reactive programming - Observable
Reactive programming - ObservableReactive programming - Observable
Reactive programming - Observable
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2
 
The new way to write a frontend software
The new way to write a frontend softwareThe new way to write a frontend software
The new way to write a frontend software
 
Robotics and Arduino (Arduino UNO)
Robotics and Arduino (Arduino UNO)Robotics and Arduino (Arduino UNO)
Robotics and Arduino (Arduino UNO)
 
Hybrid Mobile Application with Ionic Framework
Hybrid Mobile Application with Ionic FrameworkHybrid Mobile Application with Ionic Framework
Hybrid Mobile Application with Ionic Framework
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best Practices
 
Google Tag Manager (GTM)
Google Tag Manager (GTM)Google Tag Manager (GTM)
Google Tag Manager (GTM)
 

Recently uploaded

First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 

Recently uploaded (20)

First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 

Html5 - Awesome APIs

  • 1. Few HTML5 APIs You Didn’t Know ExistedFew HTML5 APIs You Didn’t Know Existed
  • 2. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation The awesome Fullscreen API allows developers to programmatically launch the browser into fullscreen mode, pending user approval: // Find the right method, call on correct element function launchFullScreen(element) { if(element.requestFullScreen) { element.requestFullScreen(); } else if(element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if(element.webkitRequestFullScreen) { element.webkitRequestFullScreen(); } } // Launch fullscreen for browsers that support it! launchFullScreen(document.documentElement); // the whole page launchFullScreen(document.getElementById("videoE lement")); // any individual element
  • 3. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation The getUserMedia API is incredibly interesting; this API provides access to device media, like your MacBook's camera! Using this API, the <video> tag, and canvas, you can take beautiful photos within your browser! var video = document.getElementById("video"); // Put video listeners into place if(navigator.getUserMedia) { // Standard navigator.getUserMedia({video: “true”}, function(stream) { video.src = stream; video.play(); }, errBack); } else if(navigator.webkitGetUserMedia) { // WebKit- prefixed navigator.webkitGetUserMedia(videoObj, function(stream){ video.src = window.webkitURL.createObjectURL(stream); video.play(); }, errBack); }
  • 4. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation This simple API provides you information about the battery's current charge level, its charging status, and allows you to be notified of changes via a few events. Let's check it out! navigator.getBattery().then(function(result) { console.log(result); // result: BatteryManagery { charging: false, chargingTime: Infinity, dischargingTime: 8940, level: 0.59, onchargingchange: null, onchargingtimechange: null, ondischargingtimechange: null, onlevelchange: null } });
  • 5. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation Firefox introduces a new strategy for website optimization: link prefetching. Link prefetching is a browser mechanism, which utilizes browser idle time to download or prefetch documents that the user might visit in the near future. A web page provides a set of prefetching hints to the browser, and after the browser is finished loading the page, it begins silently prefetching specified documents and stores them in its cache. When the user visits one of the prefetched documents, it can be served up quickly out of the browser's cache <!-- full page --> <link rel="prefetch" href="http://burnigroads.ro/race.php" /> <!-- just an image --> <link rel="prefetch" href="http://burningroads.ro/imagenec/cars/logan.png " />
  • 6. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation Mathematical Markup Language (MathML) is an dialect of XML for describing mathematical notation and capturing both its structure and content. Here you'll find links to documentation, examples, and tools to help you work with this powerful technology Use: <math><msub><msup>...
  • 7. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. WebSocket WebSocket( in DOMString url, in optional DOMString protocols ); void close(in optional unsigned long code, in optional DOMString reason); void send(in DOMString data);
  • 8. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation WebRTC (where RTC stands for Real-Time Communications) is a technology that enables audio/video streaming and data sharing between browser clients (peers). As a set of standards, WebRTC provides any browser with the ability to share application data and perform teleconferencing peer to peer, without the need to install plug-ins or third-party software
  • 9. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high performance searches of this data. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution. // Let us open our database var request = window.indexedDB.open("MyTestDatabase", 3); request.onsuccess = function(event) { db = event.target.result; // Create an objectStore for this database var objectStore = db.createObjectStore("name", { keyPath: "myKey" }); };
  • 10. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D and 2D graphics within any compatible web browser without the use of plug-ins. WebGL does so by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML5 <canvas> elements. var gl; // A global variable for the WebGL context function start() { var canvas = document.getElementById("glcanvas"); // Initialize the GL context gl = initWebGL(canvas); if (gl) { // Set clear color to black, fully opaque gl.clearColor(0.0, 0.0, 0.0, 1.0); // Enable depth testing gl.enable(gl.DEPTH_TEST); // Near things obscure far things gl.depthFunc(gl.LEQUAL); // Clear the color as well as the depth buffer. gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); } }
  • 11. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation In HTML5 any element can be editable. Using some JavaScript event handlers you can transform your web page into a full and fast rich-text editor. This article provides some information about this functionality. <!DOCTYPE html> <html> <body> <div contentEditable="true"> This text can be edited by the user. </div> </body> </html>
  • 12. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation Web Workers provide a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface. In addition, they can perform I/O using XMLHttpRequest (although the responseXML and channel attributes are always null). Once created, a worker can send messages to the JavaScript code that created it by posting messages to an event handler specified by that code (and vice versa.) var myWorker = new Worker("worker.js"); x.onchange = function() { myWorker.postMessage([first.value,second.value]); console.log('Message posted to worker'); } myWorker.onmessage = function(e) { result.textContent = e.data; console.log('Message received from worker'); }
  • 13. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation The DOM window object provides access to the browser's history through the history object. It exposes useful methods and properties that let you move back and forth through the user's history, as well as -- starting with HTML5 -- manipulate the contents of the history stack. window.history.back(); window.history.forward(); var stateObj = { foo: "bar" }; history.pushState(stateObj, "page 2", "bar.html");
  • 14. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation In order to build a good offline-capable web application, you need to know when your application is actually offline. Incidentally, you also need to know when your application has returned to an 'online' status again. You need to know when the user comes back online, so that you can re-synchronize with the server. You need to know when the user is offline, so that you can be sure to queue your server requests for a later time. function updateOnlineStatus(event) { var condition = navigator.onLine ? "online" : "offline"; status.className = condition; status.innerHTML = condition.toUpperCase(); log.insertAdjacentHTML("beforeend", "Event: " + event.type + "; Status: " + condition); } window.addEventListener('online', updateOnlineStatus);
  • 15. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation The Pointer Lock API (formerly called Mouse Lock API) provides input methods based on the movement of the mouse over time (i.e., deltas), not just the absolute position of the mouse cursor in the viewport. It gives you access to raw mouse movement, locks the target of mouse events to a single element, eliminates limits on how far mouse movement can go in a single direction, and removes the cursor from view. canvas.requestPointerLock = canvas.requestPointerLock || canvas.mozRequestPointerLock; canvas.requestPointerLock() if(document.pointerLockElement === canvas || document.mozPointerLockElement === canvas) { console.log('The pointer lock status is now locked'); } else { console.log('The pointer lock status is now unlocked'); }
  • 16. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation The geolocation API allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information. if ("geolocation" in navigator) { /* geolocation is available */ } else { /* geolocation IS NOT available */ } navigator.geolocation.getCurrentPosition(function(po sition) { do_something(position.coords.latitude, position.coords.longitude); }); var watchID = navigator.geolocation.watchPosition(function(position ) { do_something(position.coords.latitude, position.coords.longitude); });
  • 17. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation It is now possible to put a shadow to a box, using box- shadow and multiple backgrounds can be set. .multi_bg_example { width: 100%; height: 400px; background-image: url(https://mdn.mozillademos.org/files/11305/firefox.p ng), url(https://mdn.mozillademos.org/files/11307/bubbles .png), linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)); background-repeat: no-repeat, no-repeat, no- repeat; background-position: bottom right, left, right; background: -moz-linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)), -webkit- gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)), -ms-linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)), linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)); }
  • 18. Few HTML5 APIs You Didn’t Know Existed Fullscreen API getUserMedia API Battery API Link Prefetch MathML element WebSockets WebRTC IndexedDB WebGL Web Workers History API The contentEditable Attribute Pointer Lock API Online and offline events Using geolocation New background styling Detecting device orientation Increasingly, web-enabled devices are capable of determining their orientation; that is, they can report data indicating changes to their orientation with relation to the pull of gravity. In particular, hand-held devices such as mobile phones can use this information to automatically rotate the display to remain upright, presenting a wide-screen view of the web content when the device is rotated so that its width is greater than its height. window.addEventListener("deviceorientation", handleOrientation, true); function handleOrientation(event) { var absolute = event.absolute; var alpha = event.alpha; var beta = event.beta; var gamma = event.gamma; // Do stuff with the new orientation data }
  • 19. Few HTML5 APIs You Didn’t Know ExistedFew HTML5 APIs You Didn’t Know Existed Dragos Ionita Software Engineer https://ro.linkedin.com/in/dragos-ionita-8ab20756 Thanks for watching!Thanks for watching!