不同浏览器的html5本地存储 [英] html5 Local Storage Across Different Browsers

查看:137
本文介绍了不同浏览器的html5本地存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Chrome创建了本地存储,然后尝试通过Firefox访问它。但它并不存在。有人可以澄清一下,使用不同的浏览器存储和检索HTML5本地存储是否是一个有效的测试用例?根据我的理解,HTML本地存储路径是特定于浏览器的。因此,我假设您需要使用相同的浏览器进行存储,并且检索属于特定的KEY。这是一个正确的陈述吗?

I did my local storage using Chrome and then try to access it through Firefox. But it’s not there. Can somebody clarify that is it a valid test case to store and retrieve HTML5 local storage using different browsers? As per my understanding HTML local storage path is browser specific. So I assume that you need to use same browsers for both storage and retrieve belongs to a specific KEY. Is it a correct statement?

推荐答案

本地存储在该确切的浏览器中是本地的,并且只在该浏览器中。要检索存储在本地存储中的内容,您必须使用相同的浏览器,相同的密钥并从同一来源的页面(例如域)中检索它。

Local Storage is "local" in that exact browser and ONLY in that browser. To retrieve something stored in Local Storage, you must use the same browser, the same key and retrieve it from a page in the same origin (e.g. domain).

如果您想要在多个浏览器中使用某些东西,然后你必须以某种方式识别用户(通常是用户登录),然后你需要将数据存储在某个地方的服务器上,以便数据可以在多个浏览器中提供给同一个用户。

If you want something available across multiple browsers, then you have to identify the user somehow (usually a user login) and then you need to store the data on a server somewhere so that the data can be served to the same user across multiple browsers.

这篇关于不同浏览器的html5本地存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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