سؤال

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.

هل كانت مفيدة؟

المحلول

Yes this can be done, Modify your profiles.ini (/home/username/.mozilla/firefox/profiles.ini) to change the default profile each time you want to open a URL in a different profile.

I know this is a bit of a pain but it works and its the only way to do this. Now I can have multiple Firefox instances/profiles open simultaneously and still open new tabs in which ever instance I want from my shell script.

YAY!

نصائح أخرى

Unfortunately Firefox only supports one remote profile at a time, so all your command lines have to remote into the same process. (Mozilla Suite for Linux supported a per-profile remote, but then again it didn't support the -profile flag.)

On the other hand if you know all the URL(s) that you want to load in advance, then you can simply pass all of them on the Firefox command line, concatenated with | characters (but quoted to stop the shell interpreting them). So for instance if you want to start a new instance of the test profile opening the page www.google.ie (only), use firefox -no-remote -P test -browser www.google.ie

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top