对于 HTML5 本地存储,我需要 openDatabase 吗?

发布于 2024-11-18 19:53:42 字数 280 浏览 2 评论 0原文

我一直在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丶情人眼里出诗心の 2024-11-25 19:53:42

我看过的有关 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文