Sunday, March 31, 2013

JavaScript: The less known parts. Storage.

'JavaScript: The less known parts' chapters:
1. Bitwise Operators
2. Storage
3. Dom Mutations

Client side storage is almost as old as Internet itself. Back in the days we used cookies for this, but since Firefox 2 & Safari 4 browsers support DOM Storage techniques. We are probably all familiar with IndexedDB or deprecated WebSQL. Both of them are widely supported in almost all of the newest browsers:


localStorage

Thats not all - we also have well known localStorage & sessionStorage key/value client storage system. We can simply save the value in one window:
And load it in another:

The advantage of local/session storage over IndexedDB is that we can listen to an event that fires when something has changed - we can for instance propagate those changes to all the browser cards or iframes in our application. Choose the 'result' tab in the next fiddle, go back to the first one and save something using the form.
It's helpful also in IndexedDB based apps - for example PouchDB made by Dale Harvey use localStorage events with IndexedDB data to keep everything up to date everywhere.

window.name storage

We can also use window.name property to store data on the client side. This ancient method allows us to read and write data across pages and domains, even from outside the current origin. According to Wikipedia [HTTP COOKIE] we can store up to 32MB there (according to some sources its even around 60MB). It's also accessible even before domready event. And even if it's not really cleaver idea in times of tabbed browsing (every new tab starts with empty window.name), it's still used as a fallback in for older browsers. More on window.name storage:
Ajaxian: What’s in a window.name?
Cookie-less Session Variables in JavaScript
Session variables without cookies
HTML5 sessionStorage for "every" browsers

See you next Monday in the 3rd part of Javascript: The less known parts. Follow me on Twitter and stay informed about next parts!

66 comments:

  1. IT staff outsourcing services give backup support along with other IT services at any time of company's requirement. Apart from IT services you can rely on out sourcing services for necessary software equipments also.

    ReplyDelete
  2. Thanks for your post.Under hypnosis, you can become desensitized to your fears, safely and comfortably, beginning with the most subtle unconscious cues that set them off.

    Hypnosis Hong Kong

    ReplyDelete
  3. You may choose to look the other way but you can never say again that you did not know. family holidays goa india

    ReplyDelete
  4. Download Instagram Videos online with Instagram Video Downloader , all you have to is to paste the Instagram video url and then click Download button and the video downloader will grab direct video link

    ReplyDelete



  5. this is very useful informative posting !
    thank you for your sharing this good informations !

    goldenslot
    บาคาร่าออนไลน์
    gclub casino

    ReplyDelete
  6. Thank you for your post. This is excellent information.
    It is amazing and wonderful to visit your site
    goldenslot
    gclub
    gclub casino

    ReplyDelete
  7. Awesome Post! Let us know more about Happy Diwali 2017 Facebook Status
    Also download latest movies PIRATES OF THE CARIBBEAN: DEAD MEN TELL NO TALES 2017
    Also Read trending Stories Modern Society
    Also Check out Latest vacancy of Government Jobs BPSC Recruitment 2017

    ReplyDelete
  8. Great post! I am actually getting ready to across this information, It's very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    SAP Training in Chennai
    SAP ABAP Training in Chennai
    SAP FICO Training in Chennai

    ReplyDelete

  9. This blog is having the general information. Got a creative work and this is very different one.We have to
    develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful...



    SEO Company in India
    SEO Company in chennai

    ReplyDelete
  10. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.

    Microsoft Azure Training in Chennai

    ReplyDelete