是否可以将localStorage项目保密或隐藏? [英] Is it possible to keep localStorage items private or hidden?

查看:405
本文介绍了是否可以将localStorage项目保密或隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阻止某人做 -

I want to keep someone from doing -

localStorage [key] 在控制台或类似的外观我在那里。

localStorage[key] in the console or similar to look at what I have there.

这可能吗?

推荐答案

不,那是不可能的。

这样的功能毫无意义,因为在你的代码中放一个断点很容易看看你的值从本地存储中读取它。

Such a feature would be pointless, because it would be easy to put a breakpoint in your code and look at the value after you have read it from the local storage.

您可以加扰存储在存储中的值,这样它的含义并不明显,但是使用它的代码是可见,你只能让它更难看到价值,而不是不可能。

You can scramble the value that you put in the storage so that it's not obvious what it means, but as the code that uses it is visible, you can only make it harder to see the value, not impossible.

这篇关于是否可以将localStorage项目保密或隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆