是“localStorage”在火狐浏览器只工作时,页面在线? [英] Is "localStorage" in Firefox only working when the page is online?
问题描述
所以有人知道这是否是设计 - > Mozilla开发人员中心的DOM存储
(Firefox 2允许在域层次结构
中访问高于当前文档的存储
对象。这是不允许在Firefox 3中允许
更长的时间,因为
的安全原因。另外,这个
除了HTML 5之外,已经从HTML 5规范$ b $中删除
b支持localStorage,即在Firefox 3.5中实现
。)
或者是否有解决方法? >
我想知道,因为离线存储只能在网上工作,听起来很愚蠢:P
如果有人想知道,代码非常简单:
$ b $
function save()
{
localStorage.setItem('foo','bar');
函数load()
{
var test = localStorage.getItem('foo');
alert(test);
一个href =https://bugzilla.mozilla.org/show_bug.cgi?id=507361 =noreferrer> 错误507361 - localStorage不能在file:/// documents
希望很快就会被解决!
$ b 2011-09-13:Bug修复,在'Mozilla8'中实现。我使用Firefox 8测试了这个功能,它现在可以运行。
So I'm toying around with HTML 5 and the localStorage and I'm noticing that my values only get stored when I run the page in Firefox on the local host (i.e. http://127.0.0.1:8000/test/index.html), but when I run the file locally (file:///C:/test/index.html) my values don't get stored. Safari 4 has no problems with both setups. So does anybody know if this is by design -> DOM Storage on the Mozilla Developer Center
(Firefox 2 permitted access to storage objects higher in the domain hierarchy than the current document. This is no longer allowed in Firefox 3, for security reasons. In addition, this proposed addition to HTML 5 has been removed from the HTML 5 specification in favor of localStorage, which is implemented in Firefox 3.5.)
Or if there is a workaround?
I wonder because offline storage that works only online sounds silly :P
If anybody wonders, the code is as easy as it gets:
function save()
{
localStorage.setItem('foo','bar');
}
function load()
{
var test = localStorage.getItem('foo');
alert(test);
}
It seems a bug: Bug 507361 - localStorage doesn't work in file:/// documents
Hope is fixed soon!
2011-09-13: Bug fixed, implemented in 'Mozilla8'. I tested this with Firefox 8 and it works now.
这篇关于是“localStorage”在火狐浏览器只工作时,页面在线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!