对于 HTML5 本地存储,我需要 openDatabase 吗?
我一直在使用 HTML5 本地存储,使用 localStorage.getItem("something") 和 localStorage.setItem("something","somevalue") 并且它工作得很好。当然,这一切都以存在 localStorage 窗口对象为条件。
我只存储一个字符串,所以我想知道是否需要我读过的这个 openDatabase 调用。我发现的示例中有一半根本没有提及它,另一半似乎暗示它是使用本地存储的基本部分。
当我在这里时,本地存储是跨域的还是与存储它的站点的域相关?
I've been playing around with HTML5 local storage, using localStorage.getItem("something") and localStorage.setItem("something","somevalue") and it's working just fine. Of course it's all conditional upon the localStorage window object existing.
I'm only storing one string, so I'm wondering whether I need this openDatabase call that I've read about. Half the examples I've found don't mention it at all, the other half seem to imply that it's a basic part of using local storage.
While I'm here, is local storage cross-domain or is it tied to the domain of the site from which it was stored?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看过的有关 localStorage 的内容中没有提到
openDatabase
。这可能是针对 webSQL 存储的,它实际上使用不多,并且仅适用于 Safari/Chrome。LocalStorage 是同域的,就像 ajax 调用一样。
Nothing I've ever looked at concerning localStorage mentioned
openDatabase
. That's probably for webSQL storage, which isn't really used much, and only works in Safari/Chrome.LocalStorage is same-domain, just like ajax calls.