How to do two sessionStorages

Asked

Viewed 21 times

0

I am making a test system with an API and I am using pure javascript for integration via AJAX. I am storing the data in local and sessionStorage to transit between pages. My problem is the following:

I store data from a category in sessionStorage and when I do another code to store data from another object in sessionStorage, it does not create the new session. Is it so or has a way to create two sessions?

  • I’d like to see the methods you’re using to record the session.

  • window.sessionStorage.setItem('category', xhr.responseText);

  • 1

    window.sessionStorage.setItem('categoriaA',"conteudo A");
window.sessionStorage.setItem('categoriaB',"conteudo B");
console.log('window.sessionStorage');

Retornou os dois normalmente:
window.sessionStorage.length; //2

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.