How to launch a Google Chrome Tab with specific URL using C#(如何使用 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 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 C# 启动具有特定 URL 的 Google Chrome 选项
基础教程推荐
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
