移动设备的 HTML5 本地存储有多安全
我希望通过将多个表单中输入的数据存储到本地存储中来解决移动网站上的一些性能问题。
我将清除加载时的数据并清除最后一页上的数据,以便他们在移动设备上访问网站后不会在设备上留下任何敏感数据。
不过,我确实有一些担忧:
- 另一个程序可以访问我存储在本地存储中的数据吗?
- 如果用户没有完成该过程,我可以为数据设置到期日期吗?
示例:我希望数据在 30 分钟内过期,无论用户是否完成该过程、离开网站、关闭浏览器
I'm looking to work around some performance issues on a mobile site by storing the data entered on multiple forms into the local Storage.
I will be clearing the data on load and clearing the data on the last page, so no sensitive data will be left on the device after they visit the website on their mobile device.
I do have a couple of concerns though:
- Can another program access the data I store in local storage?
- If the user doesn't complete the process can I place a expiration date on the data?
Example: I want the data to expire in 30 minutes regardless if the user has finished the process, left the site, closed the browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下 sessionStorage,它的工作方式与 localStorage 类似,但一旦选项卡/窗口/浏览器关闭,就不会保留任何数据。
这也比 localStorage 更安全,因为会话结束后不会保留任何数据。 W3 存储规范中有更多有关安全性的详细信息。
但是,如果您要存储敏感数据,我建议使用 cookie,因为 sessionStorage 和 localStorage 中的数据可以由用户查看和编辑,并且可能会受到 XSS 攻击。
Take a look at sessionStorage, which works similarly to localStorage but doesn't keep any data once a tab/window/browser is closed.
This would also be more secure than localStorage as no data would be kept once a session has ended. There is more details on security in the W3 Storage spec.
However if you're storing sensitive data I'd recommend cookies as data in sessionStorage and localStorage can be viewed and edited by the user and is potentially open to XSS attacks.