How can I browse with localstorage disabled?

2019-02-05 13:15发布

问题:

A site I'm building uses localstorage with a fallback to php sessions.

How can I test my website in a localstorage free environment without downgrading Firefox, Internet Explorer 8, Chrome or Safari? So I'm probably looking for an add-on for one of these browsers?

I've tried ie7 mode in ie8 - no joy :(

回答1:

For Firefox:

Dom.storage.enabled

The Web Applications 1.0 specification defines a mechanism allowing web pages to store information with a web browser (similar to cookies) called “client-side session and persistent storage.” Although use of session storage is subject to a user’s cookie preferences, this preference allows it to be disabled entirely.

For Chrome:

Chrome/Chromium - disable HTML5 LocalStorage and Databases for all webpages /or ask user

While some resources on the Internet claims that Chrome's cookie blocking does not also block LocalStorage, I just ran a quick test and discovered that it does actually block LocalStorage, (at least in Chrome 12, the current beta version).

For IE:

Internet Explorer

Select “Tools” -> “Internet Options” -> “General” -> check “Delete browsing history on exit”, click on “Delete”, check “Cookies”, click on “Delete” once more and restart your browser afterwards.

Not really sure about Safari but I imagine it is similar to Chrome.



回答2:

Start Chrome with option/command-line switch:

--disable-local-storage


回答3:

In Firefox set dom.storage.enabled to false in about:config.



回答4:

Most simple way i've found for Chrome is to disable both Cookies and Local storage. Here's how:

Settings -> "Show advanced settings..." -> "Content settings..." -> "Block sites from setting any data"



回答5:

If you want to disable localstorage in IE. Use this

Select “Internet Options” -> “Advanced” Tab -> Go to “Security” -> uncheck “Enable DOM-Storage”