- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
LocalStorage 通常由应用程序使用。这是否意味着您的值可能会被其他应用程序操纵或删除?或者是否使用了某种命名空间,以便将值存储在每个域的基础上,而不会有被干扰的风险?提示将不胜感激。
最佳答案
localStorage
对于每个源都是唯一的,因此它 是安全的,并且不能被其他网站或应用程序干扰。
spec具体来说
The localStorage object provides a
Storage
object for an origin.
User agents must have a set of local storage areas, one for each origin.User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user.
User agents should always avoid deleting data while a script that could access that data is running.When the localStorage attribute is accessed, the user agent must run the following steps, which are known as the Storage object initialization steps:
The user agent may throw a "SecurityError" DOMException and abort these steps instead of returning a Storage object if the request violates a policy decisions (e.g. if the user agent is configured to not allow the page to persist data).
If the Document's origin is an opaque origin, then throw a "SecurityError" DOMException and abort these steps.
Check to see if the user agent has allocated a local storage area for the origin of the Document of the
Window
object on which the attribute was accessed.
If it has not, create a new storage area for that origin.Return the Storage object associated with that origin's local storage area.
Each Document object must have a separate object for itsWindow
's localStorage attribute.
请注意 "an origin"是相当明确的定义,但对于本地存储,这意味着协议(protocol)、域和端口必须匹配,两个端点才能被视为同源
关于javascript - LocalStorage 是应用程序常用的,那么如何避免不小心删除值呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40837065/
最近我编写了一个 Android 应用程序,它需要从内置相机拍摄照片并将其取回我的应用程序。我使用了众多教程中的一个,一切正常。但后来我在不同的设备上测试了它,但没有任何效果。似乎有问题,那么我如何确
开发工具:VS2010,MVC4.0,SQLSERVER2008 服务器:Windows server 2012,IIS8,SQLSERVER2012 1、发布后,每个页面第一次打开都很卡,5
这个真的让我很反感。我有一个表单,由应用程序的主要表单生成并拥有,用于搜索记录。表单布局在停靠的 TableLayoutPanel 中,结合了绝对和百分比大小的行/列,以便我的标签在数据输入和结果控件
我正在尝试做这样的事情: #include #include int main() { int l[] = {1,2,3,4}; vector vi(4); copy(l,
我正在使用 Magento 的功能来插入和更新查询。我的要求是在执行这些类型的查询时要处理 SQL 注入(inject)。但我无法找到 Magento 是如何做到这一点的。我正在提供一个起始样本。请给
用换行符分割字符串会导致麻烦的错误。请看我的回答。 原始问题 - 由于无法在日志中看到不可见字符而导致的 XY 问题。 public void DoCommand(String cmd) {
我是一名优秀的程序员,十分优秀!