SlideShare ist ein Scribd-Unternehmen logo
1 von 23
San Francisco
February 21-22, 2013
About the W3Conference

•   Website: http://www.w3.org/conf/2013sf/
•   Twitter: https://twitter.com/w3cconf
•   Twitter: https://twitter.com/search/realtime?q=%23w3conf
•   Lanyard: http://lanyrd.com/2013/w3conf/
•   Video:   http://www.w3.org/conf/2013sf/video.html
Concentrations
• Client-side storage options
• Security
• Ebooks
• HTML5 capabilities
• CSS advances
• Mobile
• Accessibility
• Open source collaboration
• JavaScript (EcmaScript) advances
Client-side Storage Options
• Cookies
• Web Storage
• Web SQL (being discontinued in favor of IndexedDB)
• IndexedDB
• File APIs
• Frameworks (such as Backbone.js)
Why Use Client-side Storage?
• Mobile applications
• Disconnected applications
 (To Do Lists, Image Processors)

• Partially disconnected applications
 (Mail Clients, Calendar, Field Devices)

• Faster web sites with offline storage
 (Offline Catalogs, User Preferences)

• Reduce network traffic
• Significantly speed up display times
• Save temporary state
• Richer UI experience with user-updated data
• Prevent work loss from network disconnects
caniuse.com – Web Storage
caniuse.com - IndexedDB
Cookies
• Included in every http request
• Data is sent unencrypted over the internet
• Restricted to 4KB storage on client-side
• Stores only strings
• Used for:
  - shopping carts
  - user login
  - personalization
  - ad tracking
  - analytics
Web Storage
• W3C Web Storage Recommendation
  Defines an API for persistent data storage of key-value pair data
  in Web Clients
• localStorage and sessionStorage
• Data is stored as string, or objects using JSON.stringify,
  have to convert other types such as ints, floats, objects, and
  booleans
• Limited to approx. 2.5 - 5MB per application
• Can hook into browser events, such as offline, online, storage
  change
• Can be disabled by the user or system administrator
• Don’t store sensitive data, as like cookies, vulnerable to cross
  site scripting attacks
• Example:
  localStorage.setItem(‘favoriteFish’, ‘herring’);
  $(‘#demo’).html(‘My fav fish is: ‘ + localStorage.getItem(‘favoriteFish’));
HTML5 sessionStorage
• User carrying out single transaction, but could have
  multiple transactions in different windows at the same
  time. Cookies don’t handle this case well. Session ends
  when browser closed
• Each page has own copy of the session storage object
• Example: Two page interaction

 Page 1:
           <label>
             <input type=“checkbox”
                onchange=“sessionStorage.insurance=checked ? ‘true’ : ‘’ “>
             I want insurance this trip.
           </label>

 Page 2:
           if (sessionStorage.insurance) { your code here }
HTML5 localStorage
• Spans multiple windows, and lasts beyond current
  session
• Is not transmitted with every request like cookies
• Example: Storing user data
 <p>
  You have viewed this page
  <span id=“count”> number of </span> time(s).
 </p>
 <script>
  if (!localStorage.pageLoadCount)
     localStorage.pageLoadCount = 0;
     localStorage.pageLoadCount =
       parseInt(localStorage.pageLoadCount) + 1;
     document.getElementById(‘count’).textContent =
       localStorage.pageLoadCount;
 </script>
IndexedDB
• Indexed Data API W3C Working Draft:
  In-browser database with key-value pairs and basic
  indexing
• Available in Synchronous API & Asynchronous API
• Stores most JS Objects
• Temporary: up to 20% of available space per app
• Permanent: can request up to 100% of available space
• Example:
  function createDB() {
     var openRequest = webkitIndexedDB.open(‘Favorites’, ‘2’);
     openRequest.onerror = errorHandler;
     openRequest.onsuccess = function(e) {
       db = openRequest.result;
       createStore(db);
     }
   }
File APIs
• Stores text and binary
• FileReader API and FileWriter API
• Example:
   function fetchImage() {
      var xhr = new XMLHttpRequest();
      xhr.open(‘GET’, ‘/img/childhood.png’, true);
      xhr.responseType = ‘arraybuffer’;
      xhr.onload = function(e) {
        saveImage(xhr.response);
      };
    xhr.send();
  }
Fall-back Strategy
For browsers that don’t support
Web Storage or IndexedDB:

• Cookies
• Backbone.js
• PersistJS
• Amplify.js
• Store.js
• And many more…
Chrome Web Storage
Parashuram Narasimhan Demos
Chrome Web Storage
Chrome Web Storage
Chrome Preferences > Show Advanced Settings >
Privacy: Content settings… > All cookies and site data…
Parashuram Narasimhan Demos
Parashuram Narasimhan Demos
Security of IndexedDB
• Mozilla info: IndexedDB uses the same-origin principle,
  which ties the store to the origin that creates it
  (typically, it is the site domain or subdomain), so it
  can’t be accessed by any other origin
• Doesn’t work for content loaded from another site
  (either <frame> or <iframe>)
• Not recommended for sensitive data
• More on security in another meeting…
Presenters
•            •

•            •

•            •

•            •

•            •

•            •

•            •

•            •

•            •
Helpful Sites
•    Canisue.com: browser and device support for features
•    Html5rocks.com: Google project about HTML5
•    HTML5 & CSS3 Readiness: Browser support tool
•    HTML Living Standard: Web Storage specifics
•    My Web Store: Example of IndexedDB by Parashuram
•    Using IndexedDB: Mozilla Developer Network How-To
•    Client-side Storage: Interesting comparison
•    WebPlatform.org: W3C standards and resources
Further Research
• There was so much information, and so many great
  resources to investigate.



• Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Save your data
Save your dataSave your data
Save your datafragphace
 
Quick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins osloQuick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins osloSonja Madsen
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & csssesharao puvvada
 
Displaying message on web page in Javascript
Displaying message on web page in JavascriptDisplaying message on web page in Javascript
Displaying message on web page in JavascriptCodewizacademy
 
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Sonja Madsen
 
[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript Storages[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript StoragesIvan Matiishyn
 
Akiban Presentation at Percona Live NYC 2012
Akiban Presentation at Percona Live NYC 2012Akiban Presentation at Percona Live NYC 2012
Akiban Presentation at Percona Live NYC 2012Akiban Technologies
 
Easy javascript
Easy javascriptEasy javascript
Easy javascriptBui Kiet
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
«How to start in web application penetration testing» by Maxim Dzhalamaga
«How to start in web application penetration testing» by Maxim Dzhalamaga «How to start in web application penetration testing» by Maxim Dzhalamaga
«How to start in web application penetration testing» by Maxim Dzhalamaga 0xdec0de
 
MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DCMike Dirolf
 
On the incoherencies in web browser access control
On the incoherencies in web browser access controlOn the incoherencies in web browser access control
On the incoherencies in web browser access controlUT, San Antonio
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat ClientPaul Klipp
 

Was ist angesagt? (20)

Save your data
Save your dataSave your data
Save your data
 
AJAX - An introduction
AJAX - An introductionAJAX - An introduction
AJAX - An introduction
 
Quick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins osloQuick start guide to java script frameworks for sharepoint add ins oslo
Quick start guide to java script frameworks for sharepoint add ins oslo
 
WS-* with WCF
WS-* with WCFWS-* with WCF
WS-* with WCF
 
HTML5 - An introduction
HTML5 - An introductionHTML5 - An introduction
HTML5 - An introduction
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & css
 
Displaying message on web page in Javascript
Displaying message on web page in JavascriptDisplaying message on web page in Javascript
Displaying message on web page in Javascript
 
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
 
[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript Storages[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript Storages
 
Beyond the page
Beyond the pageBeyond the page
Beyond the page
 
Akiban Presentation at Percona Live NYC 2012
Akiban Presentation at Percona Live NYC 2012Akiban Presentation at Percona Live NYC 2012
Akiban Presentation at Percona Live NYC 2012
 
Easy javascript
Easy javascriptEasy javascript
Easy javascript
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
Divide et impera
Divide et imperaDivide et impera
Divide et impera
 
Web fundamentals - part 1
Web fundamentals - part 1Web fundamentals - part 1
Web fundamentals - part 1
 
«How to start in web application penetration testing» by Maxim Dzhalamaga
«How to start in web application penetration testing» by Maxim Dzhalamaga «How to start in web application penetration testing» by Maxim Dzhalamaga
«How to start in web application penetration testing» by Maxim Dzhalamaga
 
MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DC
 
On the incoherencies in web browser access control
On the incoherencies in web browser access controlOn the incoherencies in web browser access control
On the incoherencies in web browser access control
 
Krug Fat Client
Krug Fat ClientKrug Fat Client
Krug Fat Client
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 

Ähnlich wie San Francisco W3Conference focuses on HTML5, CSS, JavaScript advances

In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and meJason Casden
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An OverviewNagendra Um
 
Browser-Based Digital Preservation
Browser-Based Digital PreservationBrowser-Based Digital Preservation
Browser-Based Digital PreservationMat Kelly
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersBrian Huff
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programminghotrannam
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKitJoone Hur
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to JqueryGurpreet singh
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Ganesh Kondal
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8David Chou
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The WhenFITC
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Securitychuckbt
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQueryMark Rackley
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012Alexandre Morgaut
 

Ähnlich wie San Francisco W3Conference focuses on HTML5, CSS, JavaScript advances (20)

In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
 
Browser-Based Digital Preservation
Browser-Based Digital PreservationBrowser-Based Digital Preservation
Browser-Based Digital Preservation
 
HTML5: Introduction
HTML5: IntroductionHTML5: Introduction
HTML5: Introduction
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud Developers
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programming
 
Web Standards Support in WebKit
Web Standards Support in WebKitWeb Standards Support in WebKit
Web Standards Support in WebKit
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
HTML5
HTML5HTML5
HTML5
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Security
 
SPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuerySPTechCon DevDays - SharePoint & jQuery
SPTechCon DevDays - SharePoint & jQuery
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
 

San Francisco W3Conference focuses on HTML5, CSS, JavaScript advances

  • 2. About the W3Conference • Website: http://www.w3.org/conf/2013sf/ • Twitter: https://twitter.com/w3cconf • Twitter: https://twitter.com/search/realtime?q=%23w3conf • Lanyard: http://lanyrd.com/2013/w3conf/ • Video: http://www.w3.org/conf/2013sf/video.html
  • 3. Concentrations • Client-side storage options • Security • Ebooks • HTML5 capabilities • CSS advances • Mobile • Accessibility • Open source collaboration • JavaScript (EcmaScript) advances
  • 4. Client-side Storage Options • Cookies • Web Storage • Web SQL (being discontinued in favor of IndexedDB) • IndexedDB • File APIs • Frameworks (such as Backbone.js)
  • 5. Why Use Client-side Storage? • Mobile applications • Disconnected applications (To Do Lists, Image Processors) • Partially disconnected applications (Mail Clients, Calendar, Field Devices) • Faster web sites with offline storage (Offline Catalogs, User Preferences) • Reduce network traffic • Significantly speed up display times • Save temporary state • Richer UI experience with user-updated data • Prevent work loss from network disconnects
  • 8. Cookies • Included in every http request • Data is sent unencrypted over the internet • Restricted to 4KB storage on client-side • Stores only strings • Used for: - shopping carts - user login - personalization - ad tracking - analytics
  • 9. Web Storage • W3C Web Storage Recommendation Defines an API for persistent data storage of key-value pair data in Web Clients • localStorage and sessionStorage • Data is stored as string, or objects using JSON.stringify, have to convert other types such as ints, floats, objects, and booleans • Limited to approx. 2.5 - 5MB per application • Can hook into browser events, such as offline, online, storage change • Can be disabled by the user or system administrator • Don’t store sensitive data, as like cookies, vulnerable to cross site scripting attacks • Example: localStorage.setItem(‘favoriteFish’, ‘herring’); $(‘#demo’).html(‘My fav fish is: ‘ + localStorage.getItem(‘favoriteFish’));
  • 10. HTML5 sessionStorage • User carrying out single transaction, but could have multiple transactions in different windows at the same time. Cookies don’t handle this case well. Session ends when browser closed • Each page has own copy of the session storage object • Example: Two page interaction Page 1: <label> <input type=“checkbox” onchange=“sessionStorage.insurance=checked ? ‘true’ : ‘’ “> I want insurance this trip. </label> Page 2: if (sessionStorage.insurance) { your code here }
  • 11. HTML5 localStorage • Spans multiple windows, and lasts beyond current session • Is not transmitted with every request like cookies • Example: Storing user data <p> You have viewed this page <span id=“count”> number of </span> time(s). </p> <script> if (!localStorage.pageLoadCount) localStorage.pageLoadCount = 0; localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1; document.getElementById(‘count’).textContent = localStorage.pageLoadCount; </script>
  • 12. IndexedDB • Indexed Data API W3C Working Draft: In-browser database with key-value pairs and basic indexing • Available in Synchronous API & Asynchronous API • Stores most JS Objects • Temporary: up to 20% of available space per app • Permanent: can request up to 100% of available space • Example: function createDB() { var openRequest = webkitIndexedDB.open(‘Favorites’, ‘2’); openRequest.onerror = errorHandler; openRequest.onsuccess = function(e) { db = openRequest.result; createStore(db); } }
  • 13. File APIs • Stores text and binary • FileReader API and FileWriter API • Example: function fetchImage() { var xhr = new XMLHttpRequest(); xhr.open(‘GET’, ‘/img/childhood.png’, true); xhr.responseType = ‘arraybuffer’; xhr.onload = function(e) { saveImage(xhr.response); }; xhr.send(); }
  • 14. Fall-back Strategy For browsers that don’t support Web Storage or IndexedDB: • Cookies • Backbone.js • PersistJS • Amplify.js • Store.js • And many more…
  • 15. Chrome Web Storage Parashuram Narasimhan Demos
  • 17. Chrome Web Storage Chrome Preferences > Show Advanced Settings > Privacy: Content settings… > All cookies and site data…
  • 20. Security of IndexedDB • Mozilla info: IndexedDB uses the same-origin principle, which ties the store to the origin that creates it (typically, it is the site domain or subdomain), so it can’t be accessed by any other origin • Doesn’t work for content loaded from another site (either <frame> or <iframe>) • Not recommended for sensitive data • More on security in another meeting…
  • 21. Presenters • • • • • • • • • • • • • • • • • •
  • 22. Helpful Sites • Canisue.com: browser and device support for features • Html5rocks.com: Google project about HTML5 • HTML5 & CSS3 Readiness: Browser support tool • HTML Living Standard: Web Storage specifics • My Web Store: Example of IndexedDB by Parashuram • Using IndexedDB: Mozilla Developer Network How-To • Client-side Storage: Interesting comparison • WebPlatform.org: W3C standards and resources
  • 23. Further Research • There was so much information, and so many great resources to investigate. • Thank you!