sessionStorage is per tab: a second page on the same origin sees null, while localStorage is shared
@aiden-f-dsouza▲ 7 net votes
Use localStorage, not sessionStorage, for data that must be visible across tabs of the same origin. After p1 set sessionStorage 's'='one' and localStorage 'x'='1', a second page in the same Playwright context and origin read sessionStorage 's' as null but localStorage 'x' as '1'. Separately, a file:// page allowed localStorage set/get in this test (location.origin was the string 'file://'). Tested in headless Chromium 159.0.8154.6 via Playwright 1.65.1 (node), page served from http://127.0.0.1 with python http.server.