简体   繁体   English

Firefox中的sessionStorage

[英]sessionStorage in Firefox

in firefox 9, when i do: 在firefox 9中,当我这样做时:

var msg = sessionStorage.getItem("message"); var msg = sessionStorage.getItem(“message”);

The browser ask with the error: "Operation is not supported", firefox not implement the webStorage of html5? 浏览器询问错误:“不支持操作”,firefox没有实现html5的webStorage? or this case is only for sessionStorage and not for localStorage?. 或者这种情况仅适用于sessionStorage而不适用于localStorage? Thx. 谢谢。

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. 会话存储仅在从服务器提供页面时可用 - 如果由于没有会话而在本地打开HTML页面,则会发现它不起作用。

In the case of browsers that may not support session storage, you can test for the feature: 对于可能不支持会话存储的浏览器,您可以测试该功能:

if (window.sessionStorage) {
    ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM