4

I have a shell script that creates Firefox profiles and then uses them to open multiple instances of Firefox simultaneously. The problem is how can I open a URL in a particular instance of Firefox?

I have tried

firefox -CREATEPROFILE test
firefox -P test -no-remote
firefox -P test -url www.google.ie

But the last part which is trying to open the URL using the test profile does not work, it always opens in the default profile.

Is there any way to tell Firefox from the command line to open a URL using a particular profile?

Thanks.

EDIT: I am using Linux, I don't think its possible to do what I want to do from the command line (However, Firefox command-line options are not fully documented so it could be possible). One solution to my problem would be to use JavaScript to open the tabs once the browser has been executed. I think changing the default profile to the profile I want to open each time I want to load a new URL may work also. This will require changes to profiles.ini each time a new URL is loaded. I haven't tested this but it looks promising.

4

2 回答 2

2

是的,这可以做到,修改您的profiles.ini (/home/username/.mozilla/firefox/profiles.ini) 以在每次您想在不同的配置文件中打开URL 时更改默认配置文件。

我知道这有点痛苦,但它有效,并且是唯一的方法。现在我可以同时打开多个 Firefox 实例/配置文件,并且仍然可以从我的 shell 脚本中打开我想要的任何实例的新选项卡。

耶!

于 2011-01-21T12:05:18.527 回答
1

不幸的是,Firefox 一次只支持一个远程配置文件,因此您的所有命令行都必须远程进入同一个进程。(用于 Linux 的 Mozilla 套件支持按配置文件远程,但同样不支持该-profile标志。)

另一方面,如果您事先知道要加载的所有 URL,那么您可以简单地在 Firefox 命令行中将所有这些 URL 与|字符连接起来(但引用以阻止 shell 解释它们)。因此,例如,如果您想启动一个新的配置文件实例(仅)test打开页面,请使用www.google.iefirefox -no-remote -P test -browser www.google.ie

于 2011-01-20T21:04:12.053 回答