如何使用 C# 启动具有特定 URL 的 Google Chrome 选项卡

5

本文介绍了如何使用 C# 启动具有特定 URL 的 Google Chrome 选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

有没有一种方法可以在 Google Chrome 中启动一个标签(不是新窗口),并从自定义应用程序加载特定的 URL?我的应用程序是用 C# (.NET 4 Full) 编码的.

Is there a way I can launch a tab (not a new Window) in Google Chrome with a specific URL loaded into it from a custom app? My application is coded in C# (.NET 4 Full).

我正在通过 C# 中的 SOAP 执行一些操作,一旦成功完成,我希望通过浏览器向用户呈现最终结果.

I'm performing some actions via SOAP from C# and once successfully completed, I want the user to be presented with the end results via the browser.

整个设置用于我们的内部网络,而不是供公众使用 - 因此,我只能针对特定浏览器.由于各种原因,我只针对Chrome.

This whole setup is for our internal network and not for public consumption - hence, I can afford to target a specific browser only. I am targetting Chrome only, for various reasons.

推荐答案

作为对 chrfin 的响应的简化,因为 Chrome如果安装应该在运行路径上,您可以调用:

As a simplification to chrfin's response, since Chrome should be on the run path if installed, you could just call:

Process.Start("chrome.exe", "http://www.YourUrl.com");

这对我来说似乎按预期工作,如果 Chrome 已经打开,则打开一个新标签.

This seem to work as expected for me, opening a new tab if Chrome is already open.

这篇关于如何使用 C# 启动具有特定 URL 的 Google Chrome 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14