检测如果浏览器是使用隐私浏览模式 [英] Detecting if a browser is using Private Browsing mode

查看:472
本文介绍了检测如果浏览器是使用隐私浏览模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个公司偏执安全外联网。他们想确保(除其他事项外)的用户与隐私浏览模式下浏览该网站在其网页浏览器打开,以便没有cookie或历史记录保存。

I'm building an extranet for a company paranoid about security. They want to make sure that (among other things) their users are browsing the site with the Private Browsing mode switched on in their web browser so that no cookies or history is kept.

我发现只有这个
<一href=\"http://jeremiahgrossman.blogspot.com/2009/03/detecting-private-browsing-mode.html\">http://jeremiahgrossman.blogspot.com/2009/03/detecting-private-browsing-mode.html

<一href=\"http://serverfault.com/questions/18966/force-safari-to-operate-in-private-mode-and-detect-that-state-from-a-webserver\">http://serverfault.com/questions/18966/force-safari-to-operate-in-private-mode-and-detect-that-state-from-a-webserver

理想的解决方案将使用没有或很少的JavaScript。将尝试设置一个唯一的cookie工作的所有浏览器和平台?任何人都这样做过?

The ideal solution would use no or minimal javascript. Would attempting to set a unique cookie work for all browsers and platforms? Anyone done this before?

谢谢!

更新

<一个href=\"http://crypto.stanford.edu/~collinj/research/incognito/\">http://crypto.stanford.edu/~collinj/research/incognito/使用浏览器的CSS技术,参观由fingerprinters其他posters-感谢提示提及。

http://crypto.stanford.edu/~collinj/research/incognito/ uses the CSS visited technique of the browser fingerprinters mentioned by other posters- thanks for the hints.

我喜欢它,因为它小而优雅,但还是希望能够在可能的情况做没有的JavaScript。

I like it because it is small and elegant, but still want to be able to do it without javascript if possible.

推荐答案

要任何人碰到这个问题来了,请注意截至2014年,还有如果有人在隐身浏览​​到检测不可靠或准确的方法/私营/通过JavaScript或CSS安全浏览模式。一旦工作就像CSS的历史黑客previous解决方案,至今已被所有浏览器厂商无法再使用。

To anyone else coming across this question, please note as of 2014, there is no reliable or accurate way to detect if someone is browsing in an incognito/private/safe browsing mode through Javascript or CSS. Previous solutions that once worked like the CSS history hack have since been rendered unusable by all browser vendors.

有永远不应该在这里需要来检测一个正常的一天到一天网站的隐私浏览模式时曾经需要的情况。人们选择匿名浏览和还是不匿名自身的原因。

There should never be a situation where needing to detect private browsing mode on a normal day-to-day website is ever needed. People are choosing to browsing anonymously and or not anonymously for their own reasons.

Chrome和Firefox浏览器不喜欢的localStorage禁用的功能了。他们只是它命名空间中的一个临时位置使用它的示数从从prevent网站。一旦你完成浏览,命名空间被删除,并没有什么保存。如果要为localStorage的支持,无论模式下进行测试,它总是会为支持它的浏览器返回true。

Browsers like Chrome and Firefox do not disable functionality like localStorage any more. They simply namespace it in a temporary location to prevent websites that use it from erroring out. Once you're finished browsing, the namespace is erased and nothing is saved. If you are testing for localStorage support regardless of mode, it will always return true for browsers that support it.

如果它是由一个公司内部需要,您应该制定一个浏览器插件。 Chrome和Firefox特别公开内部的API,允许插件来检查,如果用户在隐私浏览/隐身模式,并据此采取行动。它不能插件之外完成。

If it is required internally by a company, you should develop a browser plugin. Chrome and Firefox in particular expose internal API's which allow plugins to check if the user is in private browsing/incognito mode and action accordingly. It cannot be done outside of a plugin.

如果该决定是由公司提出,它是非常重要的,如果你私下是/是简单地检查隐身模式和prevents你浏览,直到打开插件应该是任何开发人员一个容易的事谁知道一点点的JavaScript。然后你会问公司全体员工安装此插件。

If the decision is being made by the company and it is important, a plugin that simply checks if you're in private/incognito mode and prevents you from browsing until turned on should be an easy feat for any developer who knows a little Javascript. You would then ask all company employees to install this plugin.

这篇关于检测如果浏览器是使用隐私浏览模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆