Html 如何在禁用本地存储的情况下浏览?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6600754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 09:25:27  来源:igfitidea点击:

How can I browse with localstorage disabled?

htmlcross-browserlocal-storage

提问by Haroldo

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

我正在构建的站点使用 localstorage 并回退到 php 会话。

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?

如何在不降级 Firefox、Internet Explorer 8、Chrome 或 Safari 的情况下,在无本地存储的环境中测试我的网站所以我可能正在寻找这些浏览器之一的附加组件?

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

我在 ie8 中尝试过 ie7 模式 - 没有乐趣:(

采纳答案by Josh Johnson

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.

Dom.storage.enabled

Web Applications 1.0 规范定义了一种机制,允许网页使用 Web 浏览器(类似于 cookie)存储信息,称为“客户端会话和持久存储”。尽管会话存储的使用取决于用户的 cookie 偏好,但此偏好允许完全禁用它。

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

Chrome/Chromium - 为所有网页禁用 HTML5 LocalStorage 和数据库/或询问用户

虽然互联网上的一些资源声称 Chrome 的 cookie 阻止也不会阻止 LocalStorage,但我只是进行了一个快速测试,发现它确实阻止了 LocalStorage(至少在 Chrome 12,当前的测试版中)。

For IE:

对于 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.

IE浏览器

选择“工具”->“Internet选项”->“常规”->勾选“退出时删除浏览历史”,点击“删除”,勾选“Cookies”,再次点击“删除”,然后重新启动浏览器。

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

对 Safari 不太确定,但我想它与 Chrome 类似。

回答by Mark

Start Chrome with option/command-line switch:

使用选项/命令行开关启动 Chrome:

--disable-local-storage

回答by robertc

In Firefox set dom.storage.enabledto falsein about:config.

在 Firefox 中设置dom.storage.enabledfalseabout:config。

回答by Jim Aho

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

我为 Chrome 找到的最简单的方法是禁用 Cookie 和本地存储。就是这样:

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

设置->“显示高级设置...”->“内容设置...”->“阻止站点设置任何数据”

回答by Himanshu sharma

If you want to disable localstorage in IE. Use this

如果你想在 IE 中禁用本地存储。用这个

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

选择“Internet选项”->“高级”选项卡->转到“安全”->取消选中“启用DOM存储”