SlideShare a Scribd company logo
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!

More Related Content

What's hot (20)

PDF
Save your data
fragphace
 
PDF
AJAX - An introduction
Eleonora Ciceri
 
PPTX
Quick start guide to java script frameworks for sharepoint add ins oslo
Sonja Madsen
 
ODP
WS-* with WCF
ppcanodehuelva
 
PDF
HTML5 - An introduction
Eleonora Ciceri
 
PDF
Introduction to html & css
sesharao puvvada
 
PPTX
Displaying message on web page in Javascript
Codewizacademy
 
PPTX
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Sonja Madsen
 
PPTX
[SoftServe IT Academy] - JavaScript Storages
Ivan Matiishyn
 
PPTX
Beyond the page
Glenn Jones
 
PPT
Akiban Presentation at Percona Live NYC 2012
Akiban Technologies
 
PPT
Easy javascript
Bui Kiet
 
PDF
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
PDF
Divide et impera
Timo Stollenwerk
 
PPTX
Web fundamentals - part 1
Bozhidar Boshnakov
 
PPTX
«How to start in web application penetration testing» by Maxim Dzhalamaga
0xdec0de
 
KEY
MongoDB Hadoop DC
Mike Dirolf
 
PPT
On the incoherencies in web browser access control
UT, San Antonio
 
PPT
Krug Fat Client
Paul Klipp
 
PDF
MongodB Internals
Norberto Leite
 
Save your data
fragphace
 
AJAX - An introduction
Eleonora Ciceri
 
Quick start guide to java script frameworks for sharepoint add ins oslo
Sonja Madsen
 
WS-* with WCF
ppcanodehuelva
 
HTML5 - An introduction
Eleonora Ciceri
 
Introduction to html & css
sesharao puvvada
 
Displaying message on web page in Javascript
Codewizacademy
 
Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Sonja Madsen
 
[SoftServe IT Academy] - JavaScript Storages
Ivan Matiishyn
 
Beyond the page
Glenn Jones
 
Akiban Presentation at Percona Live NYC 2012
Akiban Technologies
 
Easy javascript
Bui Kiet
 
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
Divide et impera
Timo Stollenwerk
 
Web fundamentals - part 1
Bozhidar Boshnakov
 
«How to start in web application penetration testing» by Maxim Dzhalamaga
0xdec0de
 
MongoDB Hadoop DC
Mike Dirolf
 
On the incoherencies in web browser access control
UT, San Antonio
 
Krug Fat Client
Paul Klipp
 
MongodB Internals
Norberto Leite
 

Similar to Notes on SF W3Conf (20)

PDF
Client-side storage
Ruben Tan
 
PPTX
Client side storage on the modern web
Rajasekharan Vengalil
 
PDF
Html5 storage suggestions for challenges.pptx
deepmoteria
 
PDF
Local Storage for Web Applications
Markku Laine
 
PDF
your browser, my storage
Francesco Fullone
 
PPT
HTML5 Data Storage
Allan Huang
 
PDF
Naked and afraid Offline Mobile
ColdFusionConference
 
PDF
Naked and afraid Offline mobile
devObjective
 
PDF
your browser, your storage
Francesco Fullone
 
PPTX
Web storage
PratikDoiphode1
 
PDF
Your browser, your storage (extended version)
Francesco Fullone
 
PPTX
HTML5 Local Storage
Lior Zamir
 
PPTX
In-browser storage and me
Jason Casden
 
PDF
Get Ahead with HTML5 on Moible
markuskobler
 
PDF
HTML5 in IE9
Buu Nguyen
 
PPTX
Html5
Zahin Omar Alwa
 
PPTX
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
PDF
An Overview of HTML5 Storage
Paul Irish
 
PDF
Html5 and beyond the next generation of mobile web applications - Touch Tou...
RIA RUI Society
 
PPTX
HTML5 on Mobile
Adam Lu
 
Client-side storage
Ruben Tan
 
Client side storage on the modern web
Rajasekharan Vengalil
 
Html5 storage suggestions for challenges.pptx
deepmoteria
 
Local Storage for Web Applications
Markku Laine
 
your browser, my storage
Francesco Fullone
 
HTML5 Data Storage
Allan Huang
 
Naked and afraid Offline Mobile
ColdFusionConference
 
Naked and afraid Offline mobile
devObjective
 
your browser, your storage
Francesco Fullone
 
Web storage
PratikDoiphode1
 
Your browser, your storage (extended version)
Francesco Fullone
 
HTML5 Local Storage
Lior Zamir
 
In-browser storage and me
Jason Casden
 
Get Ahead with HTML5 on Moible
markuskobler
 
HTML5 in IE9
Buu Nguyen
 
Mini-Training: To cache or not to cache
Betclic Everest Group Tech Team
 
An Overview of HTML5 Storage
Paul Irish
 
Html5 and beyond the next generation of mobile web applications - Touch Tou...
RIA RUI Society
 
HTML5 on Mobile
Adam Lu
 
Ad

Notes on SF W3Conf

  • 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!