SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Web Storage
                           Sebastiano Armeli-Battana
                               seba.armeli@gmail.com
                                     @sebarmeli




Sunday, 20 February 2011
Remote Data Storage




Sunday, 20 February 2011
Why Web Storage?

                 • Performance
                 • Speed
                 • Reduced load on the servers
                 • Offline applications
                 • Transaction - HTTP stateless

Sunday, 20 February 2011
History of Client-side Storage

                    • HTTP Cookie

                    • userData Behaviour in IE 5.5
                    • Local Shared Objects in Adobe Flash
                    • Google Gears

Sunday, 20 February 2011
HTML
                                    Web Storage

                      • by WHATWG / W3C
                      • HTML5? Actually not...
                      • 2 Storage Areas :
                       • localStorage
                       • sessionStorage
                       • globalStorage
Sunday, 20 February 2011
Storage API
         interface Storage {
           readonly attribute unsigned long length;

                DOMString key(in unsigned long index);

                getter any getItem(in DOMString key);

           setter creator void setItem(in DOMString
         key, in any value);

                deleter void removeItem(in DOMString key);

                void clear();
         };
Sunday, 20 February 2011
localStorage
                     • localStorage.setItem(“key1”, “value1”);
                           localStorage.setItem(“key2”, “value2”);
                     • localStorage.getItem(“key1”); // “value1”
                     • localStorage.length; //2
                     • localStorage.removeItem(“key1”);
                     • localStorage.length; // 1
                     • localStorage.clear();
                     • localStorage.length; // 0
Sunday, 20 February 2011
sessionStorage
               • sessionStorage.setItem(“key1”, “value1”);
                      sessionStorage.setItem(“key2”, “value2”);
               • sessionStorage.getItem(“key1”); // “value1”
               • sessionStorage.length; //2
               • sessionStorage.removeItem(“key1”);
               • sessionStorage.length; // 1
               • sessionStorage.clear();
               • localStorage.length; // 0
Sunday, 20 February 2011
Storing Objects
                    • Key/value pairs
                    • Value is a STRING!

                    • Stringify / Parse JS Objects
                     • JSON.stringify(myObject);
                     • JSON.parse(myString);
Sunday, 20 February 2011
Storage Event
                    • “storage” event
                    • Triggered when Storage Areas change
                    • Binded on Window
                    • Attributes:
                           •   key,
                           •   oldValue
                           •   newValue
                           •   url




Sunday, 20 February 2011
Support
                    • IE 8+
                    • FF 3.5+
                    • Safari 4+
                    • Chrome 7+
                    • Opera 10.6+
                    • iOS Safari 4.0+ / Android 2.2+
Sunday, 20 February 2011
JS Utilities
                    • YUI2 Storage

                    • Dojo Storage

                    • PersistJS

Sunday, 20 February 2011
Advantages (over Cookies)

                    • Saving Bandwith

                    • Size

                    • Sessions not leaking

                    • Network sniffing
Sunday, 20 February 2011
Limitations

                • 5 Mb (or 10Mb)
                • “QUOTA_EXCEEDED_ERR”
                • “SECURITY_ERR”
                • Storage per origin
                • Cross directory attacks -> DO not USE it!
                • DNS Spoofing -> SSL
Sunday, 20 February 2011
The future of Web Storage

                    • Store data that rarely change

                    •      Mobile Sites


                    • Offline apps

                    • More Storage?       Index Database API
Sunday, 20 February 2011
Thank you.



Sunday, 20 February 2011

Weitere ähnliche Inhalte

Andere mochten auch

Il contributo della ricerca in didattica all'insegnamento della fisica
Il contributo della ricerca in didattica all'insegnamento della fisicaIl contributo della ricerca in didattica all'insegnamento della fisica
Il contributo della ricerca in didattica all'insegnamento della fisica
Francesco Marchi
 

Andere mochten auch (7)

Il web tra fruizione critica e partecipazione
Il web tra fruizione critica e partecipazioneIl web tra fruizione critica e partecipazione
Il web tra fruizione critica e partecipazione
 
Rete, social network e sicurezza; quando gli alunni vanno in rete, uso consap...
Rete, social network e sicurezza; quando gli alunni vanno in rete, uso consap...Rete, social network e sicurezza; quando gli alunni vanno in rete, uso consap...
Rete, social network e sicurezza; quando gli alunni vanno in rete, uso consap...
 
Google Drive in pillole
Google Drive in pilloleGoogle Drive in pillole
Google Drive in pillole
 
[Google apps for Work] Migliora la capacità produttiva con Google Drive.
[Google apps for Work] Migliora la capacità produttiva con Google Drive. [Google apps for Work] Migliora la capacità produttiva con Google Drive.
[Google apps for Work] Migliora la capacità produttiva con Google Drive.
 
Tutorial Google Drive
Tutorial Google DriveTutorial Google Drive
Tutorial Google Drive
 
Il contributo della ricerca in didattica all'insegnamento della fisica
Il contributo della ricerca in didattica all'insegnamento della fisicaIl contributo della ricerca in didattica all'insegnamento della fisica
Il contributo della ricerca in didattica all'insegnamento della fisica
 
E-Learning, podcasting e Wikipedia per una didattica costruttivistica in rete
E-Learning, podcasting e Wikipedia per una didattica costruttivistica in reteE-Learning, podcasting e Wikipedia per una didattica costruttivistica in rete
E-Learning, podcasting e Wikipedia per una didattica costruttivistica in rete
 

Ähnlich wie Web Storage

JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forward
eug3n_cojocaru
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Guillaume Laforge
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
DATAVERSITY
 
2011 JavaOne Fun with EJB 3.1 and OpenEJB
2011 JavaOne Fun with EJB 3.1 and OpenEJB2011 JavaOne Fun with EJB 3.1 and OpenEJB
2011 JavaOne Fun with EJB 3.1 and OpenEJB
David Blevins
 
jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013
dmethvin
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
Wesley Hales
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
dmethvin
 

Ähnlich wie Web Storage (20)

Mobile HTML5
Mobile HTML5Mobile HTML5
Mobile HTML5
 
JavaSE - The road forward
JavaSE - The road forwardJavaSE - The road forward
JavaSE - The road forward
 
Creating a Global E-Commerce Website With E-Business Suite and Fusion Middleware
Creating a Global E-Commerce Website With E-Business Suite and Fusion MiddlewareCreating a Global E-Commerce Website With E-Business Suite and Fusion Middleware
Creating a Global E-Commerce Website With E-Business Suite and Fusion Middleware
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
Fast Map Interaction without Flash
Fast Map Interaction without FlashFast Map Interaction without Flash
Fast Map Interaction without Flash
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
 
2011 JavaOne Fun with EJB 3.1 and OpenEJB
2011 JavaOne Fun with EJB 3.1 and OpenEJB2011 JavaOne Fun with EJB 3.1 and OpenEJB
2011 JavaOne Fun with EJB 3.1 and OpenEJB
 
jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013
 
LatJUG. JSF2.0 - The JavaEE6 Standard
LatJUG. JSF2.0 - The JavaEE6 StandardLatJUG. JSF2.0 - The JavaEE6 Standard
LatJUG. JSF2.0 - The JavaEE6 Standard
 
How I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTreeHow I stopped worrying about and loved DumpRenderTree
How I stopped worrying about and loved DumpRenderTree
 
Donating a mature project to Eclipse
Donating a mature project to EclipseDonating a mature project to Eclipse
Donating a mature project to Eclipse
 
Java EE and Google App Engine
Java EE and Google App EngineJava EE and Google App Engine
Java EE and Google App Engine
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Slideshare presentation
Slideshare presentationSlideshare presentation
Slideshare presentation
 
Fun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJBFun with EJB 3.1 and Open EJB
Fun with EJB 3.1 and Open EJB
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
 
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
Integrating ECM (WebCenter Content) with your Enterprise! 5 Tips to Try, 5 Tr...
 

Mehr von Sebastiano Armeli

Mehr von Sebastiano Armeli (12)

Managing a software engineering team
Managing a software engineering teamManaging a software engineering team
Managing a software engineering team
 
Enforcing coding standards in a JS project
Enforcing coding standards in a JS projectEnforcing coding standards in a JS project
Enforcing coding standards in a JS project
 
Enforcing coding standards
Enforcing coding standardsEnforcing coding standards
Enforcing coding standards
 
ES6: The future is now
ES6: The future is nowES6: The future is now
ES6: The future is now
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
 
Dependency management & Package management in JavaScript
Dependency management & Package management in JavaScriptDependency management & Package management in JavaScript
Dependency management & Package management in JavaScript
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 
RequireJS
RequireJSRequireJS
RequireJS
 
Lazy load Everything!
Lazy load Everything!Lazy load Everything!
Lazy load Everything!
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Backbone.js in a real-life application
Backbone.js in a real-life applicationBackbone.js in a real-life application
Backbone.js in a real-life application
 
Getting started with Selenium 2
Getting started with Selenium 2Getting started with Selenium 2
Getting started with Selenium 2
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Web Storage

  • 1. Web Storage Sebastiano Armeli-Battana seba.armeli@gmail.com @sebarmeli Sunday, 20 February 2011
  • 2. Remote Data Storage Sunday, 20 February 2011
  • 3. Why Web Storage? • Performance • Speed • Reduced load on the servers • Offline applications • Transaction - HTTP stateless Sunday, 20 February 2011
  • 4. History of Client-side Storage • HTTP Cookie • userData Behaviour in IE 5.5 • Local Shared Objects in Adobe Flash • Google Gears Sunday, 20 February 2011
  • 5. HTML Web Storage • by WHATWG / W3C • HTML5? Actually not... • 2 Storage Areas : • localStorage • sessionStorage • globalStorage Sunday, 20 February 2011
  • 6. Storage API interface Storage { readonly attribute unsigned long length; DOMString key(in unsigned long index); getter any getItem(in DOMString key); setter creator void setItem(in DOMString key, in any value); deleter void removeItem(in DOMString key); void clear(); }; Sunday, 20 February 2011
  • 7. localStorage • localStorage.setItem(“key1”, “value1”); localStorage.setItem(“key2”, “value2”); • localStorage.getItem(“key1”); // “value1” • localStorage.length; //2 • localStorage.removeItem(“key1”); • localStorage.length; // 1 • localStorage.clear(); • localStorage.length; // 0 Sunday, 20 February 2011
  • 8. sessionStorage • sessionStorage.setItem(“key1”, “value1”); sessionStorage.setItem(“key2”, “value2”); • sessionStorage.getItem(“key1”); // “value1” • sessionStorage.length; //2 • sessionStorage.removeItem(“key1”); • sessionStorage.length; // 1 • sessionStorage.clear(); • localStorage.length; // 0 Sunday, 20 February 2011
  • 9. Storing Objects • Key/value pairs • Value is a STRING! • Stringify / Parse JS Objects • JSON.stringify(myObject); • JSON.parse(myString); Sunday, 20 February 2011
  • 10. Storage Event • “storage” event • Triggered when Storage Areas change • Binded on Window • Attributes: • key, • oldValue • newValue • url Sunday, 20 February 2011
  • 11. Support • IE 8+ • FF 3.5+ • Safari 4+ • Chrome 7+ • Opera 10.6+ • iOS Safari 4.0+ / Android 2.2+ Sunday, 20 February 2011
  • 12. JS Utilities • YUI2 Storage • Dojo Storage • PersistJS Sunday, 20 February 2011
  • 13. Advantages (over Cookies) • Saving Bandwith • Size • Sessions not leaking • Network sniffing Sunday, 20 February 2011
  • 14. Limitations • 5 Mb (or 10Mb) • “QUOTA_EXCEEDED_ERR” • “SECURITY_ERR” • Storage per origin • Cross directory attacks -> DO not USE it! • DNS Spoofing -> SSL Sunday, 20 February 2011
  • 15. The future of Web Storage • Store data that rarely change • Mobile Sites • Offline apps • More Storage? Index Database API Sunday, 20 February 2011
  • 16. Thank you. Sunday, 20 February 2011