在非默认浏览器中启动Web URL [英] Launch Web URL in NON-default browser
问题描述
我知道这:
Process.Start("http://www.somewebsite.com/");
在用户默认的浏览器中启动网页.但是,我正在创建一个有用的小应用程序,现在我需要能够在Chrome,Opera,Firefox和Internet Explorer中启动URL.
launches a webpage in the users default browser. But, I am creating a useful little application, and now I need to be able to launch a URL in Chrome, Opera, Firefox, and Internet Explorer.
我的默认浏览器是Chrome,但是如何在Opera或Firefox中启动URL? 这是一个个人应用程序,将仅在我的计算机上使用,因此无需考虑如何获取浏览器的安装目录.
My default browser is Chrome, but how can I launch the URL in Opera or Firefox? This is a personal application, and is only going to be used on my computer, so there is no need to think about how to get the installation directory of the browsers.
我的Firefox浏览器在这里:C:\Program Files\Mozilla Firefox\firefox.exe
使用Process.Start()
时是否需要通过将URL作为命令行参数传递给firefox.exe
来执行此操作?如果这是我需要做的,那么有人可以给我示范如何做的例子吗?
My Firefox browswer is here: C:\Program Files\Mozilla Firefox\firefox.exe
Do I need to do this by passing the URL as a command line parameter to firefox.exe
when I use Process.Start()
? And if that is what I need to do, can someone show me an example of how to do it?
推荐答案
Process.Start("C:\Program Files\Mozilla Firefox\firefox.exe", "http://www.somewebsite.com/");
另请参见:
Firefox命令行选项
Process.Start的MSDN页面
See also:
Firefox command line options
MSDN page for Process.Start
这篇关于在非默认浏览器中启动Web URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!