0

I am trying to figure out a way to see values stored in my sessions i.e. something like this plugin for cookies

Mainly trying this as this flow for sessions:

sessionStorage.setItem('token', 'someValue')
console.log(sessionStorage.getItem('token'))
console.log(sessionStorage.length)
sessionStorage.removeItem('token')
console.log(sessionStorage.length)

console logs this:

undefined
2
1

So clearly the session is being set (+ there was another one from somewhere, hence 2 sessions)

However how can I check it's value and use it in code, if it is returning undefined

Ilja
  • 44,142
  • 92
  • 275
  • 498

3 Answers3

1

Your browser's development tools probably offer this.

For instance, in Chrome's dev tools, you'd go to the Resources tab and choose Session Storage on the left, then pick the origin from the list:

enter image description here

On Firefox, the Storage Inspector is disabled by default. You have to go into dev tools, click the gear icon for dev tools settings, and enable it, but then you can use it in much the same way:

enter image description here

Other browsers' dev tools may have similar features.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
0

For example in Chrome : Right click -> Inspect-> Resources -> Session Storage -> Lists storage data for all the domains

-1

I found this list of storage locations for different browsers.

Unfortunately, it´s not certain that the files will always contain the most recent data; but I´d say it´s worth a shot.

Have you thought about setting breakpoints and use the console to read from the session?

Community
  • 1
  • 1
Titus
  • 452
  • 8
  • 19