What is Session Storage?

  1. Home
  2. Blog

What is Session Storage?

⭕ 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐒𝐄𝐒𝐒𝐈𝐎𝐍 𝐒𝐓𝐎𝐑𝐀𝐆𝐄?

  • 👉 The sessionStorage object allows you to save key/value pairs in the browser.
  • 👉 The sessionStorage object stores data for only one session..
  • 👉 The data is deleted when the browser is closed.
  • 👉 When you duplicate a tab, the sessionStorage from the original tab is copied to the duplicated tab.
  • 👉 Closing a window/tab ends the session and clears sessionStorage objects

📍 𝐌𝐄𝐓𝐇𝐎𝐃𝐒:

  • 👉 setItem(key, value) – store key/value pair.
  • 👉 getItem(key) – get the value by key.
  • 👉 removeItem(key) – remove the key with its value.
  • 👉 clear() – delete everything.
  • 👉 key(index) – get the key on a given position. 👉 length – the number of stored items.

Document: sessionStorage.pdf

  • ➡️ If you find this post helpful, share it with your connections (Let's help each other grow 👊🏻)
  • ➡️📥 Don't forget to save this Post!
  • ➡️Follow Abdul Haseeb Khan for more.

Happy watching and learning! 🙌

Author: Abdul Haseeb Khan

Software Development Consultant | Angular| MEAN Stack | Advisory IT Operations | Tech Consultant | Tech Trainer | Social Media Activist