SlideShare a Scribd company logo
The Open Web
 and what it means
The Open Web and what it means
The Open Web and what it means
Mozilla is a
global non-
profit dedicated
to putting you
in control of
your online
experience and
shaping the
future of the
Web for the
public good
The Open Web and what it means
The Open Web and what it means
@robertnyman
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
<button id="browser-id">Log in</button>

<script>
    document.querySelector("#browser-id").onclick = function () {
         navigator.id.get(function (assertion) {
             if (assertion) {
                 AJAX request to your server with the assertion
             }
         });
    }
</script>
POST request to https://browserid.org/verify with
two parameters:

curl -d "assertion=<ASSERTION>&audience=https://
mysite.com" "https://browserid.org/verify"
{
    "status": "okay",
    "email": "lloyd@example.com",
    "audience": "https://mysite.com",
    "expires": 1308859352261,
    "issuer": "browserid.org"
}
navigator.id.logout();
The Open Web and what it means
The Open Web and what it means
pdf.js
Web Apps
Open Web technologies:

HTML5, CSS, JavaScript

A manifest file
Manifest file
The Open Web and what it means
{
    "version": "1.0",
    "name": "ABBAInfo",
    "description": "Getting some ABBA info",
    "icons": {
        "16": "/abbainfo/images/icon-16.png",
        "48": "/abbainfo/images/icon-48.png",
        "128": "/abbainfo/images/icon-128.png"
    },
    "developer": {
        "name": "Robert Nyman",
        "url": "http://robertnyman.com"
    },
    "installs_allowed_from": [
        "*"
    ],
    "launch_path": "/abbainfo/",
    "locales": {
    },
    "default_locale": "en"
}
MIME type:

application/x-web-app-manifest+json
Installing a Web App
navigator.mozApps.install(
    URLToManifestFile,
    installData,
    sucessCallback,
    errorCallback
);
var mozApps = navigator.mozApps;
if (mozApps) {
    navigator.mozApps.install(
        "http://localhost/abbainfo/manifest.webapp",
        {
            "userID": "Robocop"
        },
        function () {
            console.log("Worked!");
            console.log(result);
        },
        function (result) {
            console.log("Failed :-(");
            console.log(result);
        }
    );
}
offline & localStorage
Web Apps and platforms
Introducing Web Runtime - WebRT
Currently:

Windows
Mac
Android
Future:

As many as
possible
What's needed to run/install a Web App?
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
HTML5-based WebRT:
include.js

Available at:
http://myapps.mozillalabs.com/
jsapi/include.js
The Open Web and what it means
https://myapps.mozillalabs.com/
Marketplace
The Open Web and what it means
Dev tools
The Open Web and what it means
The Open Web and what it means
Fullscreen
The Open Web and what it means
The Open Web and what it means
<button id="view-fullscreen">Fullscreen</button>

<script type="text/javascript">
(function () {
    var viewFullScreen = document.getElementById("view-fullscreen");
    if (viewFullScreen) {
        viewFullScreen.addEventListener("click", function () {
            var docElm = document.documentElement;
            if (docElm.mozRequestFullScreen) {
                docElm.mozRequestFullScreen();
            }
            else if (docElm.webkitRequestFullScreen) {
                docElm.webkitRequestFullScreen();
            }
        }, false);
    }
})();
 </script>
mozRequestFullScreenWithKeys?
html:-moz-full-screen {
    background: red;
}

html:-webkit-full-screen {
    background: red;
}
Camera
The Open Web and what it means
<input type="file" id="take-picture" accept="image/*">
takePicture.onchange = function (event) {
    // Get a reference to the taken picture or chosen file
    var files = event.target.files,
        file;
    if (files && files.length > 0) {
        file = files[0];
        // Get window.URL object
        var URL = window.URL || window.webkitURL;

         // Create ObjectURL
         var imgURL = URL.createObjectURL(file);

         // Set img src to ObjectURL
         showPicture.src = imgURL;

         // Revoke ObjectURL
         URL.revokeObjectURL(imgURL);
     }
};
Battery
The Open Web and what it means
// Get battery level in percentage
var batteryLevel = battery.level * 100 + "%";

// Get whether device is charging or not
var chargingStatus = battery.charging;

// Time until the device is fully charged
var batteryCharged = battery.chargingTime;

// Time until the device is discharged
var batteryDischarged = battery.dischargingTime;
battery.addEventLister("levelchange", function () {
    // Device's battery level changed
}, false);

battery.addEventListener("chargingchange", function () {
    // Device got plugged in to power, or unplugged
}, false);

battery.addEventListener("chargingtimechange", function () {
    // Device's charging time changed
}, false);

battery.addEventListener("dischargingtimechange", function () {
    // Device's discharging time changed
}, false);
IndexedDB
// IndexedDB
var indexedDB = window.indexedDB || window.webkitIndexedDB ||
window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB,
    IDBTransaction = window.IDBTransaction ||
window.webkitIDBTransaction || window.OIDBTransaction ||
window.msIDBTransaction,
    dbVersion = 1;

// Create/open database
var request = indexedDB.open("elephantFiles", dbVersion);
createObjectStore = function (dataBase) {
    // Create an objectStore
    dataBase.createObjectStore("elephants");
}

// Currently only in latest Firefox versions
request.onupgradeneeded = function (event) {
    createObjectStore(event.target.result);
};
request.onsuccess = function (event) {
    // Create XHR
    var xhr = new XMLHttpRequest(),
        blob;

    xhr.open("GET", "elephant.png", true);

    // Set the responseType to blob
    xhr.responseType = "blob";

    xhr.addEventListener("load", function () {
        if (xhr.status === 200) {
            // Blob as response
            blob = xhr.response;

            // Put the received blob into IndexedDB
            putElephantInDb(blob);
        }
    }, false);
    // Send XHR
    xhr.send();
}
putElephantInDb = function (blob) {
    // Open a transaction to the database
    var transaction = db.transaction(["elephants"], IDBTransaction.READ_WRITE);

     // Put the blob into the dabase
     var put = transaction.objectStore("elephants").put(blob, "image");

     // Retrieve the file that was just stored
     transaction.objectStore("elephants").get("image").onsuccess = function (event) {
         var imgFile = event.target.result;

          // Get window.URL object
          var URL = window.URL || window.webkitURL;

          // Create and revoke ObjectURL
          var imgURL = URL.createObjectURL(imgFile);

          // Set img src to ObjectURL
          var imgElephant = document.getElementById("elephant");
          imgElephant.setAttribute("src", imgURL);

          // Revoking ObjectURL
          URL.revokeObjectURL(imgURL);
     };
};
Boot to Gecko
The Open Web and what it means
The Open Web and what it means
https://github.com/andreasgal/B2G

https://github.com/andreasgal/gaia
The Open Web and what it means
Telephony & SMS
// Telephony object
var tel = navigator.mozTelephony;

// Check if the phone is muted (read/write property)
console.log(tel.muted);

// Check if the speaker is enabled (read/write property)
console.log(tel.speakerEnabled);

// Place a call
var call = tel.dial("123456789");
// Receiving a call
tel.onincoming = function (event) {
    var incomingCall = event.call;

     // Get the number of the incoming call
     console.log(incomingCall.number);

     // Answer the call
     incomingCall.answer();
};

// Disconnect a call
call.hangUp();
// SMS object
var sms = navigator.mozSMS;

// Send a message
sms.send("123456789", "Hello world!");

// Recieve a message
sms.onrecieved = function (event) {
    // Read message
    console.log(event.message);
};
Vibration
(function () {
    document.querySelector("#vibrate-one-second").addEventListener("click",
        function () {
            navigator.mozVibrate(1000);
        }, false);

    document.querySelector("#vibrate-twice").addEventListener("click",
        function () {
            navigator.mozVibrate([200, 100, 200, 100]);
        }, false);



    document.querySelector("#vibrate-long-time").addEventListener("click",
        function () {
            navigator.mozVibrate(5000);
        }, false);

    document.querySelector("#vibrate-off").addEventListener("click",
        function () {
            navigator.mozVibrate(0);
        }, false);
})();
Try new things
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
The Open Web and what it means
Take care of each other
Robert Nyman
robertnyman.com/speaking/ robnyman@mozilla.com
robertnyman.com/html5/    Twitter: @robertnyman
robertnyman.com/css3/

More Related Content

PDF
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
Robert Nyman
 
PDF
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
PDF
HTML5 & The Open Web - at Nackademin
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
Robert Nyman
 
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
HTML5 & The Open Web - at Nackademin
Robert Nyman
 
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao Paulo
Robert Nyman
 

What's hot (20)

PDF
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform
Robert Nyman
 
PDF
HTML5, The Open Web, and what it means for you - MDN Hack Day, Sao Paulo
Robert Nyman
 
PDF
JavaScript Promise
Joseph Chiang
 
PDF
Web Crawling with NodeJS
Sylvain Zimmer
 
PDF
Javascript Frameworks for Joomla
Luke Summerfield
 
PDF
Introduction to ECMAScript 2015
Tomasz Dziuda
 
PDF
iPhone Appleless Apps
Remy Sharp
 
PDF
Websockets talk at Rubyconf Uruguay 2010
Ismael Celis
 
PDF
Service workers
jungkees
 
PDF
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
PPTX
Bare-knuckle web development
Johannes Brodwall
 
PDF
Joe Walker Interactivewebsites Cometand Dwr
deimos
 
PDF
The Fine Art of JavaScript Event Handling
Yorick Phoenix
 
PDF
HTML5 APIs - Where No Man Has Gone Before! - GothamJS
Robert Nyman
 
PDF
PWA 與 Service Worker
Anna Su
 
PDF
Introduction to ReasonML
Riza Fahmi
 
KEY
Lazy Loading Because I'm Lazy
Johnathan Leppert
 
PDF
Perkenalan ReasonML
Riza Fahmi
 
KEY
JavaScript Testing for Rubyists
Jamie Dyer
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Robert Nyman
 
JavaScript APIs - The Web is the Platform
Robert Nyman
 
HTML5, The Open Web, and what it means for you - MDN Hack Day, Sao Paulo
Robert Nyman
 
JavaScript Promise
Joseph Chiang
 
Web Crawling with NodeJS
Sylvain Zimmer
 
Javascript Frameworks for Joomla
Luke Summerfield
 
Introduction to ECMAScript 2015
Tomasz Dziuda
 
iPhone Appleless Apps
Remy Sharp
 
Websockets talk at Rubyconf Uruguay 2010
Ismael Celis
 
Service workers
jungkees
 
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
Bare-knuckle web development
Johannes Brodwall
 
Joe Walker Interactivewebsites Cometand Dwr
deimos
 
The Fine Art of JavaScript Event Handling
Yorick Phoenix
 
HTML5 APIs - Where No Man Has Gone Before! - GothamJS
Robert Nyman
 
PWA 與 Service Worker
Anna Su
 
Introduction to ReasonML
Riza Fahmi
 
Lazy Loading Because I'm Lazy
Johnathan Leppert
 
Perkenalan ReasonML
Riza Fahmi
 
JavaScript Testing for Rubyists
Jamie Dyer
 
Ad

Viewers also liked (9)

PDF
Wissenstechnologie Iv 08 09
mgrani
 
PDF
JBL Control Series
milesocampo
 
PDF
HTML5 APIs - The New Frontier - Jfokus 2011
Robert Nyman
 
PDF
Wissenstechnologie Iii 08 09
mgrani
 
PDF
Wissenstechnologie Vi 08 09
mgrani
 
PDF
Wissenstechnologie Ii 08 09.Voll
mgrani
 
PDF
Soundcraft Epm Mpm
milesocampo
 
PDF
Wissenstechnologie I
mgrani
 
PPT
Quantuvis Q Tower Sound System Layout by SAX
milesocampo
 
Wissenstechnologie Iv 08 09
mgrani
 
JBL Control Series
milesocampo
 
HTML5 APIs - The New Frontier - Jfokus 2011
Robert Nyman
 
Wissenstechnologie Iii 08 09
mgrani
 
Wissenstechnologie Vi 08 09
mgrani
 
Wissenstechnologie Ii 08 09.Voll
mgrani
 
Soundcraft Epm Mpm
milesocampo
 
Wissenstechnologie I
mgrani
 
Quantuvis Q Tower Sound System Layout by SAX
milesocampo
 
Ad

Similar to The Open Web and what it means (20)

PDF
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
PDF
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
 
PDF
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - Geek Meet
Robert Nyman
 
PDF
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman
 
PDF
Taking Web Apps Offline
Pedro Morais
 
PDF
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
PDF
Service Worker - Reliability bits
jungkees
 
PDF
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
KEY
BlackBerry DevCon 2011 - PhoneGap and WebWorks
mwbrooks
 
PDF
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
PDF
The Beauty Of Java Script V5a
rajivmordani
 
PDF
JavaScript para Graficos y Visualizacion de Datos
philogb
 
PDF
The Beauty of Java Script
Michael Girouard
 
PDF
Mozilla Web Apps - Super-VanJS
Robert Nyman
 
PDF
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
philogb
 
PPT
DWR, Hibernate and Dojo.E - A Tutorial
jbarciauskas
 
PDF
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
Frédéric Harper
 
PDF
Pushing the Web: Interesting things to Know
n|u - The Open Security Community
 
PDF
HTML5: huh, what is it good for?
Remy Sharp
 
PDF
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - Geek Meet
Robert Nyman
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman
 
Taking Web Apps Offline
Pedro Morais
 
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
Service Worker - Reliability bits
jungkees
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
mwbrooks
 
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
The Beauty Of Java Script V5a
rajivmordani
 
JavaScript para Graficos y Visualizacion de Datos
philogb
 
The Beauty of Java Script
Michael Girouard
 
Mozilla Web Apps - Super-VanJS
Robert Nyman
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
philogb
 
DWR, Hibernate and Dojo.E - A Tutorial
jbarciauskas
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
Frédéric Harper
 
Pushing the Web: Interesting things to Know
n|u - The Open Security Community
 
HTML5: huh, what is it good for?
Remy Sharp
 
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 

More from Robert Nyman (20)

PDF
Have you tried listening?
Robert Nyman
 
PDF
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
PDF
Introduction to Google Daydream
Robert Nyman
 
PDF
Predictability for the Web
Robert Nyman
 
PDF
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
PDF
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
PDF
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
PDF
Google tech & products
Robert Nyman
 
PDF
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
PDF
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go
Robert Nyman
 
PDF
Google, the future and possibilities
Robert Nyman
 
PDF
Developer Relations in the Nordics
Robert Nyman
 
PDF
What is Developer Relations?
Robert Nyman
 
PDF
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
PDF
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
PDF
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 
Have you tried listening?
Robert Nyman
 
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
Introduction to Google Daydream
Robert Nyman
 
Predictability for the Web
Robert Nyman
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
Google tech & products
Robert Nyman
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
The web - What it has, what it lacks and where it must go
Robert Nyman
 
Google, the future and possibilities
Robert Nyman
 
Developer Relations in the Nordics
Robert Nyman
 
What is Developer Relations?
Robert Nyman
 
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 

Recently uploaded (20)

PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
PDF
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
This slide provides an overview Technology
mineshkharadi333
 
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 

The Open Web and what it means

  • 1. The Open Web and what it means
  • 4. Mozilla is a global non- profit dedicated to putting you in control of your online experience and shaping the future of the Web for the public good
  • 14. <button id="browser-id">Log in</button> <script> document.querySelector("#browser-id").onclick = function () { navigator.id.get(function (assertion) { if (assertion) { AJAX request to your server with the assertion } }); } </script>
  • 15. POST request to https://browserid.org/verify with two parameters: curl -d "assertion=<ASSERTION>&audience=https:// mysite.com" "https://browserid.org/verify"
  • 16. { "status": "okay", "email": "[email protected]", "audience": "https://mysite.com", "expires": 1308859352261, "issuer": "browserid.org" }
  • 22. Open Web technologies: HTML5, CSS, JavaScript A manifest file
  • 25. { "version": "1.0", "name": "ABBAInfo", "description": "Getting some ABBA info", "icons": { "16": "/abbainfo/images/icon-16.png", "48": "/abbainfo/images/icon-48.png", "128": "/abbainfo/images/icon-128.png" }, "developer": { "name": "Robert Nyman", "url": "http://robertnyman.com" }, "installs_allowed_from": [ "*" ], "launch_path": "/abbainfo/", "locales": { }, "default_locale": "en" }
  • 28. navigator.mozApps.install( URLToManifestFile, installData, sucessCallback, errorCallback );
  • 29. var mozApps = navigator.mozApps; if (mozApps) { navigator.mozApps.install( "http://localhost/abbainfo/manifest.webapp", { "userID": "Robocop" }, function () { console.log("Worked!"); console.log(result); }, function (result) { console.log("Failed :-("); console.log(result); } ); }
  • 31. Web Apps and platforms
  • 35. What's needed to run/install a Web App?
  • 50. <button id="view-fullscreen">Fullscreen</button> <script type="text/javascript"> (function () { var viewFullScreen = document.getElementById("view-fullscreen"); if (viewFullScreen) { viewFullScreen.addEventListener("click", function () { var docElm = document.documentElement; if (docElm.mozRequestFullScreen) { docElm.mozRequestFullScreen(); } else if (docElm.webkitRequestFullScreen) { docElm.webkitRequestFullScreen(); } }, false); } })(); </script>
  • 52. html:-moz-full-screen { background: red; } html:-webkit-full-screen { background: red; }
  • 56. takePicture.onchange = function (event) { // Get a reference to the taken picture or chosen file var files = event.target.files, file; if (files && files.length > 0) { file = files[0]; // Get window.URL object var URL = window.URL || window.webkitURL; // Create ObjectURL var imgURL = URL.createObjectURL(file); // Set img src to ObjectURL showPicture.src = imgURL; // Revoke ObjectURL URL.revokeObjectURL(imgURL); } };
  • 59. // Get battery level in percentage var batteryLevel = battery.level * 100 + "%"; // Get whether device is charging or not var chargingStatus = battery.charging; // Time until the device is fully charged var batteryCharged = battery.chargingTime; // Time until the device is discharged var batteryDischarged = battery.dischargingTime;
  • 60. battery.addEventLister("levelchange", function () { // Device's battery level changed }, false); battery.addEventListener("chargingchange", function () { // Device got plugged in to power, or unplugged }, false); battery.addEventListener("chargingtimechange", function () { // Device's charging time changed }, false); battery.addEventListener("dischargingtimechange", function () { // Device's discharging time changed }, false);
  • 62. // IndexedDB var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB, IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction, dbVersion = 1; // Create/open database var request = indexedDB.open("elephantFiles", dbVersion);
  • 63. createObjectStore = function (dataBase) { // Create an objectStore dataBase.createObjectStore("elephants"); } // Currently only in latest Firefox versions request.onupgradeneeded = function (event) { createObjectStore(event.target.result); };
  • 64. request.onsuccess = function (event) { // Create XHR var xhr = new XMLHttpRequest(), blob; xhr.open("GET", "elephant.png", true); // Set the responseType to blob xhr.responseType = "blob"; xhr.addEventListener("load", function () { if (xhr.status === 200) { // Blob as response blob = xhr.response; // Put the received blob into IndexedDB putElephantInDb(blob); } }, false); // Send XHR xhr.send(); }
  • 65. putElephantInDb = function (blob) { // Open a transaction to the database var transaction = db.transaction(["elephants"], IDBTransaction.READ_WRITE); // Put the blob into the dabase var put = transaction.objectStore("elephants").put(blob, "image"); // Retrieve the file that was just stored transaction.objectStore("elephants").get("image").onsuccess = function (event) { var imgFile = event.target.result; // Get window.URL object var URL = window.URL || window.webkitURL; // Create and revoke ObjectURL var imgURL = URL.createObjectURL(imgFile); // Set img src to ObjectURL var imgElephant = document.getElementById("elephant"); imgElephant.setAttribute("src", imgURL); // Revoking ObjectURL URL.revokeObjectURL(imgURL); }; };
  • 72. // Telephony object var tel = navigator.mozTelephony; // Check if the phone is muted (read/write property) console.log(tel.muted); // Check if the speaker is enabled (read/write property) console.log(tel.speakerEnabled); // Place a call var call = tel.dial("123456789");
  • 73. // Receiving a call tel.onincoming = function (event) { var incomingCall = event.call; // Get the number of the incoming call console.log(incomingCall.number); // Answer the call incomingCall.answer(); }; // Disconnect a call call.hangUp();
  • 74. // SMS object var sms = navigator.mozSMS; // Send a message sms.send("123456789", "Hello world!"); // Recieve a message sms.onrecieved = function (event) { // Read message console.log(event.message); };
  • 76. (function () { document.querySelector("#vibrate-one-second").addEventListener("click", function () { navigator.mozVibrate(1000); }, false); document.querySelector("#vibrate-twice").addEventListener("click", function () { navigator.mozVibrate([200, 100, 200, 100]); }, false); document.querySelector("#vibrate-long-time").addEventListener("click", function () { navigator.mozVibrate(5000); }, false); document.querySelector("#vibrate-off").addEventListener("click", function () { navigator.mozVibrate(0); }, false); })();
  • 82. Take care of each other