I would say that the types of Web Storage that I know of are these:
- Local Storage AKA Browser History Storage
- Session Storage AKA Window Storage and possibly also any new window derivatized from that window
Local Storage AKA Browser History Storage will persist until the browser’s history is cleared.
Session storage or Window Storage and possibly also any new window derivatized from that window will persist as long as any relevant window stays opened.
Local Storage is an API with commands like:
localStorage.setItem('first_example', 0);
localStorage.setItem('second_example', 'A');
localStorage.getItem('first_example');
localStorage.getItem('second_example');
localStorage.removeItem('first_example');
localStorage.removeItem('second_example');
localStorage.getItem('first_example');
localStorage.getItem('second_example');
localStorage.setItem('first_example', 0);
localStorage.setItem('second_example', 'A');
console.log(localStorage);
localStorage.clear()
const letters = ['A', 'B', 'C', 'D', 'E']
localStorage.setItem('letters', letters)
localStorage.getItem('letters');
localStorage.removeItem('letters');
But is there such a thing as a tab storage? I want to store client-side data just for a relevant tab.
It doesn’t matter if the webpage changes ; as long as it’s the same tab, the same client-side data will be stored.
How can this be done?