检测浏览器是否正在使用私密浏览模式 [英] Detecting if a browser is using Private Browsing mode

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

问题描述

我正在为一家关于安全的公司建立一个外部网络。他们想要确保(除其他事项外)他们的用户正在浏览网站,在他们的网络浏览器中打开隐私浏览模式,以便不保存Cookie或历史记录。



我发现只有这
http:// jeremiahgrossman.blogspot.com/2009/03/detecting-private-browsing-mode.html

http://serverfault.com/questions/18966/force-safari-to-operate-in- private-mode-and-detect-that-state-from-a-webserver



理想的解决方案将使用no或minimal javascript。尝试为所有浏览器和平台设置唯一的Cookie工作?






更新



http:// crypto。 stanford.edu/~collinj/research/incognito/ 使用其他海报所提到的浏览器指纹识别器的CSS访问技术 - 感谢提示。



I喜欢它,因为它是小而优雅,但仍然希望能够做到没有javascript,如果可能的话。

解决方案

对于遇到此问题的任何人,请注意,自2014年起,没有可靠或准确的方法来检测是否有人通过Javascript或CSS在无痕/私人/安全浏览模式下浏览。以前的解决方案曾经像CSS历史记录黑客一样,已经被所有浏览器供应商无法使用。



不应该有一种情况,需要检测隐私浏览模式正常的日常网站是必要的。人们选择匿名浏览,或者不是匿名浏览自己的原因。



Chrome和Firefox之类的浏览器不会禁用localStorage等功能。他们只是将其命名空间在临时位置,以防止使用它的网站错误。一旦完成浏览,命名空间将被删除,并且不保存任何内容。



如果公司内部需要它,你应该开发一个支持它的浏览器。浏览器插件。 Chrome和Firefox特别公开了内部API,允许插件检查用户是否处于隐身浏览/隐身模式并采取相应措施。



如果决定是由公司决定的,这很重要,一个插件只是检查你是否在私人/隐身模式,阻止您浏览,直到打开应该是一个容易的壮举任何开发人员谁知道一个小Javascript。然后,您将要求所有公司员工安装此插件。


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.

I found only this http://jeremiahgrossman.blogspot.com/2009/03/detecting-private-browsing-mode.html and http://serverfault.com/questions/18966/force-safari-to-operate-in-private-mode-and-detect-that-state-from-a-webserver

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?

thanks!


update

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

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

解决方案

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.

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.

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.

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天全站免登陆