我可以在不同的域中使用相同的HTML5浏览器存储吗? [英] Can I use the same HTML5 browser storage, across different domains?

查看:116
本文介绍了我可以在不同的域中使用相同的HTML5浏览器存储吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两种不同的方法来选择HTML5浏览器存储(IndexedDB,Web存储),但是根据我在规范中所读的内容,适用相同的来源策略".

There are a couple of different approaches for choosing an HTML5 browser storage (IndexedDB, Web Storage), but from what I read in the spec, the "same origin policy applies".

有没有一种方法可以将数据保留在浏览器中,并使其在www.domain1.com/myapp1和www.domain2.com/myapp2中都可用?

Is there a way to keep data inside the browser and have it available from both www.domain1.com/myapp1 and www.domain2.com/myapp2?

推荐答案

跨文档消息传递

您可以使用一种称为跨文档消息传递的技术来完成此任务. 此处有一篇文章概述了如何来实现它,但是基本上这是两个域相互通信并传递信息,而不是直接访问其数据存储的地方,这是HTML 5规范禁止的.

Cross-Document Messaging

You can use a technique called cross-document messaging to accomplish this. There is an article here that outlines how to implement it, but it's basically where two domains talk to each other and pass information instead of directly accessing their data store, which the HTML 5 spec prohibits.

这篇关于我可以在不同的域中使用相同的HTML5浏览器存储吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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