我们可以在不同域的两个页面之间使用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.
答
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.
另请参阅: