如果我运行该项目,它将使用Google Chrome 正常模式启动。但是如何使用Google Chrome 隐身模式启动它?
3 回答
使用Visual Studio 2015 / 2017 / 2019非常简单。您只需添加--incognito
命令行开关并将浏览器命名为Google Chrome-Incognito之类的名称。
您可以使用Visual Studio 中的Browse With..选项来执行此操作。
第 1 步:
第 2 步:
注意:您可以使用Firefox和Internet Explorer执行相同的操作。在这里,我使用 -private选项
添加Internet Explorer 。
对于
谷歌浏览器:"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito
火狐:"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -private-window
Internet Explorer/Microsoft Edge:"C:\Program Files\Internet Explorer\iexplore.exe" -private
对于 Visual Studio 2017
- 选择通常显示 IIS Express 的按钮
- 单击向下箭头
- 选择
Browse With...
- 点击
Add...
- 接下来
Program
写谷歌浏览器的路径,例如。C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
- 接下来
Arguments
写--incognito
- 接下来
Friendly name
写Google Chrome (Incognito)
(或任何适合您的需要)
- 点击
OK
- 从之前选择您的友好名称(例如
Google Chrome (Incognito)
),然后单击Set as Default
现在,当您单击 IIS Express 旁边的播放按钮时,Google Chrome 将以隐身模式启动。
不是答案,但如果有人偶然发现这个问题,寻找 Visual Studio Code 解决方案,这对我有用:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Chrome: localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/app"
},
{
"type": "chrome",
"request": "launch",
"runtimeArgs": [
"--incognito"
],
"name": "Incog Chrome: localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/app"
}
]
}
-private-window
但是,目前这在使用带有参数的 Firefox 调试扩展时不起作用。希望能帮助到你。