+ 1
What ?
Can someone explain to me what it means when it says: "Local storage is per domain. All pages from one domain can store and access the same data."? I don't understand.
7 Respostas
+ 3
What do you mean by << example website or softway >> ? @@
You could start to check this link about webstorage in general, wich provide other links to useful pages about reference and example/tuto about how to use it:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API
+ 2
Meanning is that if your page is hosted on 'mywebsite.com', so only pages hosted at this domain name can read and write the same data since browsers will create a private storage for each website.
If you have a first page wich save a value in localstorage key 'mydata' (variable name identifier), so any page of the same website will read the saved value, but any other website cannot read it, until it save a value for that key (without overwriting those saved by others websites).
+ 2
Browser doesn't << store website in "History" >>, but create a private space allocated to each domain (less or more equivalent to website) to store data (only accessible by each specific domain) in similar way as it do for cookies (but with improvements, among which higher space capacity ;)
Webstorage (both localstorage and sessionstorage) was primarly intented to replace cookies for user/client side data storing, meaning that cookies should be used if you want be able to access those data on server side ( unlike webstorage, cookies are send and updated with Http requests/responses )...
+ 1
"Web storage offers two different storage areas—local storage and session storage—which differ in scope and lifetime. Data placed in local storage is per origin (the combination of protocol, hostname, and port number as defined in the same-origin policy) (the data is available to all scripts loaded from pages from the same origin that previously stored the data) and persists after the browser is closed. Session storage is per-origin-per-window-or-tab and is limited to the lifetime of the window." - wikipedia
Hope that helps :)
+ 1
yes,I totally understand that statement! thank you visph! So...my next query is :"Is there any example website or softway for session storage?"
+ 1
Thank you GUYS! 😊
0
@visph "browser will create a private storage for each website" Is that mean the browser will store the website in "History"?