Session Storage, Local Storage, Cookies ->
All 3 are shared for all sessions of a particular domain.
On the contrary all 3 are different for different domains.
For ex - All sessions of linkedIn share same storage data. If we log out of 1 we get logged out automatically of other sessions too.
Moreover, Amazon can't access the storage data of Netflix.
Local Storage V/S Session Storage V/S Cookies
Cookie Value
document.cookie
'_sharedID=de3d9297-7954-4a4c-8a0c-67ca81de78c8; _sharedID_cst=TyylLI8srA%3D%3D; _lr_env_src_ats=false; _ga=GA1.1.1881356554.1713978274; _cc_id=459e38e4f515aaa00f6f403c72df0cf4; _sharedID_last=Sat%2C%2011%20May%202024%2011%3A35%3A57%20GMT; _lr_retry_request=true; panoramaId_expiry=1715513760937; panoramaId=0f47b52cc4648a97ed9f5f997762a9fb927ac7264ca1250414ef6e71d0a09b17; panoramaIdType=panoDevice; __gads=ID=1af2437ee61d3e76:T=1713978275:RT=1715427360:S=ALNI_Mb8t_GAjGLWKJ2QEGALY_hM3AwBoQ; __gpi=UID=00000df95d1a0bfe:T=1713978275:RT=1715427360:S=ALNI_MaKva-B4ZGlQ9UxNANbiRAAfGi2WA; __eoi=ID=0fc95bf2a95362c2:T=1713978275:RT=1715427360:S=AA-AfjZkmIA4405HCva2xUWE3Crs; _ga_9YNMTB56NB=GS1.1.1715427358.6.0.1715427361.57.0.0; cto_bundle=SEKK2V9JdVdnckpnZlBPaUxEaUhZcm5ERFNFWkROcDRBZXdSUkhmTG1RV3NRMXBKNG5ZYjNQM0FobVpOTjl0NXd4d0VUT3loYzBxWmJXR2MlMkJ4WnB0NHolMkI3YkdpJTJCRyUyQlJzSGg3RHp5TjQ3MHRtaUdHSU9hczVMcGRhJTJCNjVKQWMxNUNmTmkyazBJRW4zQU1xR2p1WmhJN2p2U0JIdVBobjhvU3Q3RDJrYkN1RGxNY3U1RjlwWnJyWFVDVUpnd0dkQUpWMnMwbUJMNU04QU5wampmdHlGc0JKWlU1dyUzRCUzRA'
Session Storage
Write
sessionStorage.setItem("abc", 2)
sessionStorage
//Storage {abc: '2', length: 1}
sessionStorage.getItem("abc")
//'2'
Top comments (0)