Firefox has a little security feature built in that won't allow localStorage (HTML5 feature) access if you have custom cookie options set. Well, being a developer I need full control over each cookie that pops so I can monitor and check values as they are get/set.
I ran into this last April after a Firefox update rendered the Facebook site half-operational and no errors being thrown. And rather than take the time to troubleshoot I uninstalled Firefox and installed a fresh, clean copy without any add-ons. Of course, I went into the custom options immediately and changed the cookie settings so I could be asked every time. If I would have left the default values Firefox would have worked on Facebook. But, since I modified the settings I found that Facebook still wasn't working. At the time I didn't realize where the issue lied so I just used my tablet when I wanted to check in at Facebook. Or a different browser. Frustrating? Oh yes, but I figured it was a Facebook code issue and left it at that.
Fast forward to a custom contract where I decided to use HTML5 localStorage (http://dev.w3.org/html5/webstorage/) and I kept getting errors when testing in my browser. Armed with my new keyword (localStorage) I did an internet search and came across a bug report as well as a blog post, both authored by Eric Meyer:
[
bugzilla.mozilla.org...]
[
meyerweb.com...]
Turns out that Meyer ran into the problem about the same time I did but he took the time to figure out what was going on.
So, I waited way too long to post this in a Firefox browser forum but figured it should be laid out for others who are either
- Using Firefox for web browsing
- Using Firefox for development and testing
Oh, one last thing for developers. You can wrap your attempt at using localStorage in a try/catch block and handle accordingly. The Gecko docs have an example workaround handler or if you are using Modernizr you can load one of the polyfills from there instead. This is by no means a working solution but it should get you started in the proper direction if you find yourself in the same situation:
try {
localStorage.foo = localStorage.foo == 'undefined'
? 'true'
: localStorage.foo
;
} catch (e) {
// set your own handler or use a polyfill:
// [developer.mozilla.org...] OR
// [github.com...]
}