HTML5 Web Storage Notes

  • string-based
  • normally have 5 megabytes of space in a browser. However, 1 character does not equal to 1 byte in web character encoding.
  •  sessionStorage
    • API is used exactly the same way as localStorage (see below for demo)
    • Refers to browser tab session, not user sessions
    • Data live forever as long as the tab is not being closed
    • Data is not shared across browser window/tab
  • in-private browsing:
    • localStorage will act like sessionStorage
    • Safari won’t store any data at all in private mode

See HTML5 localStorage code