我们可以在不同域的两个页面之间使用 IndexedDB 吗? [英] Can we use IndexedDB between two pages on different domains?

查看:56
本文介绍了我们可以在不同域的两个页面之间使用 IndexedDB 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的一页中创建了一个 IndexdDB 对象存储(让对象存储名称为ShopStore").现在我想从不同的页面打开相同的对象存储.可能吗?

I have created a IndexdDB object store in my one page (Let object store name is "ShopStore"). Now I want to open the same object store from a diffirent page. Is it possible?

我的两个网页在不同的域中.

My two web pages are on different domain.

推荐答案

根据 MDN 您不能对 indexedDB 进行跨域访问(出于安全原因,您不希望另一个网站修改您的客户端数据库):

According to MDN you can't do cross domain access to an indexedDB (for security reason, you don't want that another website modify your client database):

IndexedDB 遵循同源策略.因此,虽然您可以访问域内存储的数据,但不能跨域访问数据.

IndexedDB follows a same-origin policy. So while you can access stored data within a domain, you cannot access data across different domains.

另见:

这篇关于我们可以在不同域的两个页面之间使用 IndexedDB 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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