SlideShare uma empresa Scribd logo
1 de 25
localStorage > cookies
                     Making the Switch in Modern Browsers




Presented by
Shane Riley
@shaneriley • github.com/shaneriley • shaneriley.com
In the Beginning...
And it was good enough
Differences
Cookies        localStorage
Differences
Cookies               localStorage

• All in one string
Differences
Cookies               localStorage

• All in one string
• Expire
Differences
Cookies               localStorage

• All in one string
• Expire
• Cross-subdomain
Differences
Cookies               localStorage

• All in one string    • Properties on Object
• Expire
• Cross-subdomain
Differences
Cookies               localStorage

• All in one string    • Properties on Object
• Expire               • No expiration
• Cross-subdomain
Differences
Cookies               localStorage

• All in one string    • Properties on Object
• Expire               • No expiration
• Cross-subdomain      • Local to subdomain
Storage Limits
Cookies                               localStorage
Guaranteed minimum of 300              localStorage 2.5mb limit per
cookies, 4kb per, 20 per host/         domain (Webkit stores as
domain. Overhead costs per             UTF-16), unlimited properties
cookie (~50char).                      per domain, spec recommends
                                       using same storage across
                                       subdomains, no expiry



localStorage support: http://dev-test.nemikor.com/web-storage/support-test/
Methods!
getItem/setItem
removeItem


  clear
key

Not at all useful. Use an object iterator instead.
localStorage > cookies!
But not great (,_,)
localStorage stores ALL entries as strings
But wait! There is hope!
But wait! There is hope!
Make your own storage
          methods
https://gist.github.com/3798945
Detect support
Thanks!




Presented by
Shane Riley
@shaneriley • github.com/shaneriley • shaneriley.com

Mais conteúdo relacionado

Destaque

jQuery Foundation Keynote
jQuery Foundation KeynotejQuery Foundation Keynote
jQuery Foundation Keynote
Richard Worth
 
Sizzle jQCon San Francisco 2012
Sizzle jQCon San Francisco 2012Sizzle jQCon San Francisco 2012
Sizzle jQCon San Francisco 2012
livelogos
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
dmethvin
 

Destaque (12)

App cache vs localStorage
App cache vs localStorageApp cache vs localStorage
App cache vs localStorage
 
jQuery and Ruby Web Frameworks
jQuery and Ruby Web FrameworksjQuery and Ruby Web Frameworks
jQuery and Ruby Web Frameworks
 
New Perspectives on Performance
New Perspectives on PerformanceNew Perspectives on Performance
New Perspectives on Performance
 
jQuery Foundation Keynote
jQuery Foundation KeynotejQuery Foundation Keynote
jQuery Foundation Keynote
 
Sizzle jQCon San Francisco 2012
Sizzle jQCon San Francisco 2012Sizzle jQCon San Francisco 2012
Sizzle jQCon San Francisco 2012
 
JavaScript tracing, debugging, profiling made simple with spy-js
JavaScript tracing, debugging, profiling made simple with spy-jsJavaScript tracing, debugging, profiling made simple with spy-js
JavaScript tracing, debugging, profiling made simple with spy-js
 
HTML5 Local Storage
HTML5 Local StorageHTML5 Local Storage
HTML5 Local Storage
 
JS-Everywhere - LocalStorage Hands-on
JS-Everywhere - LocalStorage Hands-onJS-Everywhere - LocalStorage Hands-on
JS-Everywhere - LocalStorage Hands-on
 
jQuery Conference 2012 keynote
jQuery Conference 2012 keynotejQuery Conference 2012 keynote
jQuery Conference 2012 keynote
 
jQuery and Ajax
jQuery and AjaxjQuery and Ajax
jQuery and Ajax
 
Bootstrap 3 Basic - Bangkok WordPress Meetup
Bootstrap 3 Basic - Bangkok WordPress MeetupBootstrap 3 Basic - Bangkok WordPress Meetup
Bootstrap 3 Basic - Bangkok WordPress Meetup
 
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
Bootstrap 3 - Sleek, intuitive, and powerful mobile first front-end framework...
 

Semelhante a Localstorage > Cookies

London devops logging
London devops loggingLondon devops logging
London devops logging
Tomas Doran
 
Sun storage tek 6140 technical presentation
Sun storage tek 6140 technical presentationSun storage tek 6140 technical presentation
Sun storage tek 6140 technical presentation
xKinAnx
 
Sun storage tek 6140 customer presentation
Sun storage tek 6140 customer presentationSun storage tek 6140 customer presentation
Sun storage tek 6140 customer presentation
xKinAnx
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
Alluxio, Inc.
 

Semelhante a Localstorage > Cookies (20)

Presentation database on flash
Presentation   database on flashPresentation   database on flash
Presentation database on flash
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
 
Things I wish I knew about GemStone
Things I wish I knew about GemStoneThings I wish I knew about GemStone
Things I wish I knew about GemStone
 
Leveraging MongoDB: An Introductory Case Study
Leveraging MongoDB: An Introductory Case StudyLeveraging MongoDB: An Introductory Case Study
Leveraging MongoDB: An Introductory Case Study
 
London devops logging
London devops loggingLondon devops logging
London devops logging
 
GemStone/64 product update and road map
GemStone/64 product update and road mapGemStone/64 product update and road map
GemStone/64 product update and road map
 
Cache on Delivery
Cache on DeliveryCache on Delivery
Cache on Delivery
 
Sun storage tek 6140 technical presentation
Sun storage tek 6140 technical presentationSun storage tek 6140 technical presentation
Sun storage tek 6140 technical presentation
 
Speed Matters
Speed MattersSpeed Matters
Speed Matters
 
Store Beyond Glorp
Store Beyond GlorpStore Beyond Glorp
Store Beyond Glorp
 
Accelerating Rails with edge caching
Accelerating Rails with edge cachingAccelerating Rails with edge caching
Accelerating Rails with edge caching
 
Offline survival in the deadzone
Offline survival in the deadzoneOffline survival in the deadzone
Offline survival in the deadzone
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
 
Responding rapidly when you have 100+ GB data sets in Java
Responding rapidly when you have 100+ GB data sets in JavaResponding rapidly when you have 100+ GB data sets in Java
Responding rapidly when you have 100+ GB data sets in Java
 
Practical ,Transparent Operating System Support For Superpages
Practical ,Transparent Operating System Support For SuperpagesPractical ,Transparent Operating System Support For Superpages
Practical ,Transparent Operating System Support For Superpages
 
Sun storage tek 6140 customer presentation
Sun storage tek 6140 customer presentationSun storage tek 6140 customer presentation
Sun storage tek 6140 customer presentation
 
The Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent StorageThe Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent Storage
 
Elasticsearch Arcihtecture & What's New in Version 5
Elasticsearch Arcihtecture & What's New in Version 5Elasticsearch Arcihtecture & What's New in Version 5
Elasticsearch Arcihtecture & What's New in Version 5
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
 

Localstorage > Cookies

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n