sessionStorage in Firefox

岁酱吖の 提交于 2019-12-07 06:13:37

问题


in firefox 9, when i do:

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

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.


回答1:


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) {
    ...


来源:https://stackoverflow.com/questions/8924387/sessionstorage-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!