Can localStorage be modified by the client?

I am trying to use localStorage as a substitute for cookies (disable cookies) so that users can stay logged in to my site.

What I had planned so far was to save the username in localStorage and check that something was in localStorage, and if something is in localStorage, it will push the localStorage data into the PHP file via POST and click to start a new PHP session and return them to where they were.

Although I have a problem, I know that localStorage can be viewed, in which case it is possible to encrypt the data server will make sense.

But can LocalStorage data be changed? If not, it would be nice to do it, even without encryption, but obviously, if the user could change the data of the local storage, they would have access to the accounts of others, which, as you can imagine, is not very good.

I have a doubt, because JavaScript can be executed by the client in the browser, that is:

javascript:alert("hello");

Could not find out varStore localStorage name and reset value like this?

javascript:localStorage.setItem('sessionusername','superadmin');

Basically, I ask: is it possible to modify client-side HTML5 local storage data?

Cheers, Karan :)

+8
source share
3 answers

Local storage is bound to a domain, so in the usual case, the user cannot change it in any other domain or on the local host.

/, .

, - .

+9

, . Foundstone HTML5 Local Storage Explorer Firefox, localStorage , :

Local storage explorer

, , . , , . , , " ", .

: , , Firefox . Ctrl + Shift + I, "", " ", , :

Localstorage browser
, Firefox ( )

+11

, , - , . , , , javascript localalstorage, , , . localstorage Mozilla. :( . , -.

0

All Articles