Can I use the same HTML5 browser storage, across d

2019-07-19 05:26发布

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".

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?

2条回答
Juvenile、少年°
2楼-- · 2019-07-19 06:23

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.

查看更多
手持菜刀,她持情操
3楼-- · 2019-07-19 06:33

That seems fraught with peril, I'm going to say that there's something in the spec to prevent that. Otherwise you could inject bad data into someone elses app.

查看更多
登录 后发表回答