如何使用 Javascript 打开新的隐身窗口?(谷歌浏览器)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2228118/
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
How to open new incognito window with Javascript? (Google Chrome)
提问by Dois
I want to help my friend open a website in a new incognito window when he performs some mouse gestures (custom stroke in Mouse Stroke - Chrome Extension).
我想帮助我的朋友在执行一些鼠标手势时在新的隐身窗口中打开一个网站(鼠标笔画中的自定义笔画 - Chrome 扩展程序)。
回答by eggyal
Chrome extensions with the tabspermission can use the chrome.windows.createmethod:
有tabs权限的Chrome 扩展可以使用以下chrome.windows.create方法:
chrome.windows.create({"url": url, "incognito": true});
However, to access it, you'll either need to write your own extension or find an existing one which provides a suitable hook (I don't know whether this can be done with "Mouse Stroke"—I'm too scared to look).
但是,要访问它,您要么需要编写自己的扩展程序,要么需要找到一个提供合适钩子的现有扩展程序(我不知道这是否可以通过“鼠标中风”来完成——我不敢看)。

