如何使用 Firefox 打开不同配置文件中的外部链接?

chr*_*ris 7 firefox

我有两个在单独的配置文件下运行的 Firefox 实例:

$ firefox -P default &
...
$ firefox -no-remote -P second &
Run Code Online (Sandbox Code Playgroud)

现在我可以从命令行打开一个新选项卡:

$ firefox -new-tab http://unix.stackexchange.com
Run Code Online (Sandbox Code Playgroud)

但是如何在第二个配置文件中打开一个新选项卡?

这个:

$ firefox -P second -new-tab http://unix.stackexchange.com
Run Code Online (Sandbox Code Playgroud)

在默认配置文件中打开一个选项卡,同时:

$ firefox -no-remote -P second -new-tab http://unix.stackexchange.com
Run Code Online (Sandbox Code Playgroud)

抱怨已经有一个实例在该配置文件下运行。

Vol*_*gel 3

它现在可以在 Linux 上运行firefox29.0:

要打开firefox具有不同配置文件的第二个实例:

firefox -P second -new-instance

要在已运行的操作系统的第二个实例中打开新选项卡firefox

firefox -P second -remote "openurl(http://example.com,new-tab)"


请参阅Bug 716110 - 将 -new-instance 标志从现有 -no-remote 标志中分离出来,以获取更多提示(例如:Hayo 的帖子)。

正如此错误报告的评论中所解释的,缺少的是可用于以相同方式打开第一个窗口和第二个选项卡的命令:

这可以通过如下 ( firefox-profile-instance) 的脚本来完成:

#!/bin/bash

PROFILE="$1"
URL="$2"

if firefox -P "$PROFILE" -remote "ping()" >/dev/null 2>&1 ; then
    firefox -P "$PROFILE" -remote "openurl($URL,new-tab)"
else
    firefox -P "$PROFILE" -new-instance "$URL" &
fi
Run Code Online (Sandbox Code Playgroud)

现在,虽然具有默认配置文件的 Firefox 已经在运行,但
第一次运行会启动一个配置文件为“second”的新浏览器:

firefox-profile-instance second "http://example.com"

再次运行相同的命令会在同一浏览器中打开第二个选项卡:

firefox-profile-instance second "http://example.com"