如何在Chrome无痕模式中开启网址 [英] How to open a URL in chrome incognito mode

查看:1244
本文介绍了如何在Chrome无痕模式中开启网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Chrome设置为默认浏览器。要在Chrome中打开网址,我写了:

I set Chrome as default brower. To open a URL in Chrome, I wrote:

Process.Start("http://domain.com");

有什么办法可以在无痕模式下通过c#打开该网址(通常按Ctrl + Shift + N) ?

Is any way to open that URL in incognito mode by c# (nomarly press Ctrl + Shift + N)?

推荐答案

您需要创建一个包含Chrome的exe文件路径的进程,并使用参数 - incognito

You'll need to create a process with a path to Chrome's exe file, and use the argument --incognito.

Windows中的Chrome路径通常为:

The path to chrome in windows is typically:

C:\Users\< UserName> \AppData\Local\Google\Chrome\chrome.exe

使用以下代码:

var url = "http://www.google.com";

using (var process = new Process())
{
    process.StartInfo.FileName = @"C:\Users\<UserName>\AppData\Local\Google\Chrome\chrome.exe";
    process.StartInfo.Arguments = url + " --incognito";

    process.Start();
}

解释此问题的文章:http://www.tech-recipes.com/rx/ 3479 / google-chrome-use-a-command-line-switch-to-open-in-incognito-mode /

线路交换机目录: http://peter.sh/experiments/chromium-command-line-switches/

这篇关于如何在Chrome无痕模式中开启网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆