How to open a URL in chrome incognito mode

后端 未结 4 1855
暖寄归人
暖寄归人 2021-02-02 12:25

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

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

Is any way to open that URL in incognit

相关标签:
4条回答
  • 2021-02-02 12:36

    I wrote this and it successfull:

    Process.Start(@"chrome.exe", "--incognito http://domain.com");
    
    0 讨论(0)
  • 2021-02-02 12:41

    For anyone using the Brave browser, the solution is very similar to Dan's answer, just with the brave.exe path (note that for Brave, the exe is not located in %LocalAppData%).

    var url = "http://www.google.com";
    
    using (var process = new Process())
    {
        process.StartInfo.FileName = @"C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe";
        process.StartInfo.Arguments = url + " --incognito";
    
        process.Start();
    }
    
    0 讨论(0)
  • 2021-02-02 12:44

    The path to chrome.exe has changed, or at least i think there is a different between x32 and x64. C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

    0 讨论(0)
  • 2021-02-02 12:50

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

    The path to chrome in windows is typically:

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

    Use the following code:

    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();
    }
    

    An article explaining this: http://www.tech-recipes.com/rx/3479/google-chrome-use-a-command-line-switch-to-open-in-incognito-mode/

    The full chrome command-line switch directory: http://peter.sh/experiments/chromium-command-line-switches/

    0 讨论(0)
提交回复
热议问题