javascript 通过 HTML/JS 的新 Chrome 隐身窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6363290/
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
New Chrome Incognito Window via HTML/JS
提问by Andrew Hunt
Possible Duplicate:
How to open new incognito window with Javascript? (Google Chrome)
Is it possible to open a new incognito window to a URL of my choosing via either some attributes on a hyperlink or some javascript? If it is, how do I do it?
是否可以通过超链接上的某些属性或某些 javascript 打开一个新的隐身窗口到我选择的 URL?如果是,我该怎么做?
回答by brymck
There's an easy way if (and only if) you're developing an extension:
如果(且仅当)您正在开发扩展程序,则有一种简单的方法:
chrome.windows.create({
url: "http://www.google.com",
incognito: true
});
It requires tabs
permission in the manifest, but that's it.
它需要tabs
清单中的许可,仅此而已。
Note that the above has the user consent to allowing the extension to enter incognito mode, among other tab-related permission. I can't tell 100% whether you're developing an extension -- I assume not -- but in any case that's the extension solution and there isn't one otherwise.
请注意,上述内容已获得用户同意,允许扩展程序进入隐身模式,以及其他与选项卡相关的权限。我无法 100% 确定您是否正在开发扩展——我假设不是——但无论如何这就是扩展解决方案,否则就没有。
回答by oori
Seems not. You can not force incognito from within the html/js code. You can only load the browser with
似乎没有。您不能从 html/js 代码中强制隐身。您只能加载浏览器
-incognito
-隐身
switch to force it to incognito on load.
切换以强制它在加载时隐身。