-1

我想用相同的链接打开 2 个不同的浏览器。我找到了如何打开默认浏览器,但我也想打开一个非默认浏览器,我似乎找不到方法。

4

1 回答 1

1

要打开non default浏览器,您需要知道它的安装位置和浏览器。之后,您可以使用以下命令打开它:

Runtime rt = null;
rt =  Runtime.getRuntime();
rt.exec("<PATH TO FIREFOX>\\firefox.exe <WEBSITE TO OPEN>");


<PATH TO FIREFOX> = Path to whatever browser you need to open.
firefox.exe = Launcher for the browser.
<WEBSITE TO OPEN> = Website URL you are trying to open.

打开隐私浏览:使用标签-private-window

例子:

rt.exec("<PATH TO FIREFOX>\\firefox.exe -private-window <WEBSITE TO OPEN>");
于 2018-03-14T19:17:48.937 回答