Sunday, November 11, 2012

sessionStorage core concepts

I just played with sessionStorage for the first time and it is easy:

  • set it: sessionStorage.setItem("session_id", value);
  • get it: var sid = sessionStorage.getItem("session_id");

 
 

sid above will be null if the code in the second bullet is run first before something like that of the first bullet. I confirmed that if you are able to populate "sid" and then you turn around and close and reopen the browser that sid will be null unless you repopulate it. Yay!

No comments:

Post a Comment