Saturday, February 26, 2022

New Functionality: Session Storage interaction

Just added to BASIC Anywhere Machine:

  • SetSessionStorageItem(key, value)
  • GetSessionStorageItem(key)

Sample BASIC program:

SetSessionStorageItem ("salutation", "howdy, buddy")
Print GetSessionStorageItem ("salutation")
SetSessionStorageItem (1, 5)
Print GetSessionStorageItem (1)


Please take the following with a grain of salt, as this is my recently acquired understanding based on what I've read (experience-based understanding is pending!):

Difference between these and the "LocalStorage" counterparts:

  • LocalStorage is persistent (i.e. will still be available after browser/computer restart) and shared among all "same site" web pages across open same-browser instances and browser tabs
  • SessionStorage is temporary and only persistent in the current browser tab's access to a web page (close the tab or navigate to some other website, and temporary storage is gone.)

More info to follow as I slowly wrap my mind around practical uses cases for one vs the other.

Cheers !

No comments:

Post a Comment

🖥 Pongy game

This program is a port (and slight mod) of the QB64pe program by SierraKen.  (SierraKen's program shared with the QB64pe community in th...