我们可以使用其他域中的localStorage的值吗 [英] Can we use the value of localStorage from other domain

查看:55
本文介绍了我们可以使用其他域中的localStorage的值吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个域中的本地存储中存储一个值,比方说www.abc.com.如果我从同一浏览器访问两个域,是否可以从其他域(www.pqr.com)检索该值.

I am storing a value in local Storage in one domain let say www.abc.com. Can i retrieve that value from other domain(www.pqr.com) if i am accessing both domain from same browser.

推荐答案

否,您不能将一个域的本地存储用于另一个域.本地存储基于域.您不能从位于不同域的本地存储中进行读取或写入,即使在其子域中也是如此.您可以通过子域上的iframe使用它.请仔细阅读本文跨域LocalStorage 以获得详细信息解释.

No, you can't use the local storage of one domain to other domain. Local Storage is domain based. You can’t read or write from localstorage that’s on different domain even on it's subdomain. you can use it via Iframe on your subdomain. Please go through this article Cross-Domain LocalStorage for detailed explanation.

希望会有所帮助.:)

这篇关于我们可以使用其他域中的localStorage的值吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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