简体   繁体   English

有没有办法通过使用 javascript 检查浏览器是否在隐身模式下工作?

[英]Is there any way to check browser works with incognito mode or not by using javascript?

I want to check browser mode by using Javascript.我想使用 Javascript 检查浏览器模式。 I found this link, but it doesn't work for new version of Chrome.我找到了这个链接,但它不适用于新版本的 Chrome。 Is there any new way to check this?有什么方法可以检查吗?

This is an old question, but to answer it: yes, you can still detect incognito in Chromium-based browsers.这是一个老问题,但要回答它:是的,您仍然可以在基于 Chromium 的浏览器中检测隐身。 The gist is you call navigator.storage.estimate() and compare the quota property to performance.memory.jsHeapSizeLimit.要点是您调用 navigator.storage.estimate() 并将配额属性与 performance.memory.jsHeapSizeLimit 进行比较。 If the quota is less than jsHeapSizeLimit, it's incognito.如果配额小于 jsHeapSizeLimit,则为隐身。

I have a script that you can take a look at.我有一个脚本,你可以看看。

https://github.com/Joe12387/detectIncognito https://github.com/Joe12387/detectIncognito

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript 效果仅适用于“隐身模式”(Chrome) - Javascript effect works in "Incognito mode" only (Chrome) 有没有办法默认允许在隐身模式下扩展? - is there any way to allow extensions in incognito mode by default? 用于跨浏览器检测隐身模式的Javascript(私人浏览) - Javascript For Cross Browser Detection of Incognito Mode (Private Browsing) JavaScript HTTP 请求不在隐身模式下 - JavaScript HTTP Request Not in Incognito Mode sessionStorage.getItem('key')可以触发异常吗? 隐身模式? 任何旧的手机浏览器? - Can sessionStorage.getItem('key') trigger an exception? incognito mode? Any old mobile phone browser? jQuery侦听器在隐身模式Chrome中间歇性工作 - Jquery listener works intermittently in incognito mode chrome 好像浏览器处于隐身模式一样发出获取请求? - Making a get request as if the browser is in incognito mode? Javascript:是否可以检查浏览器缓存中是否存在资产? - Javascript: Any way to check if an asset is present in browser cache? 在隐身模式下使用chrome.browsingData.remove() - Using chrome.browsingData.remove() in incognito mode 有没有办法使用 javascript 切换到上一个浏览器选项卡? - Is there any way to shift to previous browser tab using javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM