简体   繁体   中英

LocalStorage Firefox 3.6

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

Even though Firefox supports localStorage, it can be turned off. Check that it is turned on.

Go to about:config and check that dom.storage.enabled is set to true .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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