本地存储火狐浏览器 3.6
根据我读到的所有内容,Firefox 3.5+ 支持 localStorage。但我在 Firefox 3.6 中看到了警报(失败)。我的 Firefox 中是否有一些奇怪的设置?有什么想法吗?
function supports_html5_storage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
alert('failing');
return false;
}
}
注意:该页面有一个 HTML5 文档类型(尽管我认为这没有什么区别)。
According to everything I've read, Firefox 3.5+ supports localStorage. And yet I'm seeing the alert (failing) in Firefox 3.6. Do I have some strange settings in my Firefox? Any ideas?
function supports_html5_storage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
alert('failing');
return false;
}
}
Note: The page has an HTML5 doctype (though I think this makes no difference).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尽管 Firefox 支持 localStorage,但它可以被关闭。检查它是否已打开。
转到
about:config
并检查dom.storage.enabled
是否设置为true
。Even though Firefox supports localStorage, it can be turned off. Check that it is turned on.
Go to
about:config
and check thatdom.storage.enabled
is set totrue
.我刚刚遇到了 http://meyerweb 中描述的错误。 com/eric/thoughts/2012/04/25/firefox-failing-localstorage/:如果您将 cookie 选项设置为“每次询问”,Firefox 将不允许本地存储。奇怪但真实,至少在我当时使用的《FF12》中是这样。解决方法是将您的 cookie 设置为在会话期间保留或直到它们过期。
I just ran into the bug described at http://meyerweb.com/eric/thoughts/2012/04/25/firefox-failing-localstorage/: Firefox disallows local storage if you have your cookie options set to "Ask every time". Strange but true, at least in FF12 that I was using at the time. Workaround is to set your cookies to keep for session or until they expire.