如何使用 C# 启动具有特定 URL 的 Google Chrome 选项卡 [英] How to launch a Google Chrome Tab with specific URL using C#

查看:51
本文介绍了如何使用 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 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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