Firefox中的sessionStorage [英] sessionStorage in Firefox

查看:762
本文介绍了Firefox中的sessionStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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