-2

In my project i need get when open my project i want t get all opened session storage for current browser.

I have tried like this but it gives current tab session storage

console.log(sessionStorage);
  • It *sounds like* you want to read `window.sessionStorage` from all open **browser** tabs, but you haven't provided any additional context. Please describe what exactly it is you're trying to do and include code from any attempted solutions. – André Dion Sep 08 '15 at 17:00
  • Please give some more details. Are you using session storage service? If not whats the key value of the storage ? – Jagadesh K Sep 08 '15 at 17:02

1 Answers1

0

It seems that you want to get all sessionStorage objects for all the browser tabs that are opened. If that is the case, you cannot do that: sessionStorage and localStorage are both subject to the same-origin policy based on the host (even though a.domain.com can access b.domain.com storage object on some cases, that's largely frowned upon and should not generally be done).

If what you are looking for is a way to share data between multiple tabs of your own domain, use localStorage instead of sessionStorage.

Marcelo
  • 4,580
  • 7
  • 29
  • 46
  • It is possible to [access `localStorage` across domains](https://stackoverflow.com/questions/33957477/cross-domain-localstorage-with-javascript) using `window.postMessage`. – Anderson Green May 03 '22 at 14:15