Reputation: 1029
I would like to create a webpage that will use local storage if it is available, but if not (e.g. the user's browser doesn't support it), will attempt to use cookies instead. In order to test this functionality on my own computer, which has only modern browsers installed, I'd like to simulate an older browser by disabling local storage while leaving cookies allowed. In Firefox, the dom.storage.enabled option apparently cannot do this, because it affects both local storage AND cookies. Any way around this?
Upvotes: 0
Views: 2819
Reputation: 3866
As a quick and dirty solution, you could run this script in your browser for temporary disabling:
delete window.localStorage;
Upvotes: 3
Reputation: 324750
Presumably you have something like if(window.localStorage)
to test the feature. Dummy it out.
// nuke it completely:
if( window.localStorage && false)
// add a "debug mode":
if( window.localStorage && !location.href.match(/[?&]nolocalstorage=1/))
// access your page with example.com/file.html?nolocalstorage=1
There are other ways, of course, but this should give you the general idea.
Upvotes: 5