问题描述
在firefox 9中,当我这样做时:
in firefox 9, when i do:
var msg = sessionStorage.getItem(message);
var msg = sessionStorage.getItem("message");
浏览器询问错误:不支持操作,firefox没有实现html5的webStorage?或者这种情况仅适用于sessionStorage而不适用于localStorage?
Thx。
The browser ask with the error: "Operation is not supported", firefox not implement the webStorage of html5? or this case is only for sessionStorage and not for localStorage?.Thx.
推荐答案
会话存储仅在您从服务器提供页面时可用 - 您会发现因为没有会话而在本地打开HTML页面它不起作用。
Session storage is only available when you are serving your page from a server - you'll find that it doesn't work if you open the HTML page locally because there is no session.
如果浏览器可能不支持会话存储,则可以测试功能:
In the case of browsers that may not support session storage, you can test for the feature:
if (window.sessionStorage) {
...
这篇关于Firefox中的sessionStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!