multi-account-containers
multi-account-containers copied to clipboard
Container cmdline option when opening URLs
Hey lovely devs!
I use containers extensively to separate my personal browsing from the work I do for various clients, and there's one functionality I'd love more than anything else; the ability to specify the container when opening a URL from the command-line. For example:
firefox --container=Work http://example.com/
I'd even be happy with a less-human-friendly version like needing to specify the container by index or uuid, since when I'm opening URLs using the cmdline it's almost always via a helper tool or script.
Thanks again for adding this functionality to Firefox!
~ Paul
This likely can't be part of the extension itself however we probably should raise a platform bug to add it there if there is sufficient interest.
@jonathanKingston : Hooray, thank you!
What's the preferred way to demonstrate there's sufficient interest?
We're starting to triage and prioritize based on the number of 👍 these issues get.
By the way, if this gets approved to be added to the Firefox platform itself, it appears to me the way to do it would be to start looking handURIToExistingBrowser - something along the lines of using cmdLine.handleFlagWithParam("container", false)
to extract the passed-in container name.
This would be useful in conjunction with my new project https://github.com/mortenn/BrowserPicker In that regard it would be beneficial if the different containers are listed somewhere easy to read, like the windows registry (HKCU). Or indeed if each container was added as a separate browser in the windows registry.
@mortenn there is already a file for this, however I wouldn't advise using it.
My issue with this is container names may change rapidly and without a programatic way to query these names and IDs then this will likely lead to breakage. An extension could however be added to the browser to convey these changes over nativeMessaging and that would be far more advised than what you are suggesting @mortenn I think.
BrowserPicker is fairly browser agnostic, so if each container was registered as a separate browser in windows, there would be no need for special handling in BrowserPicker. Other applications looking up browsers in the standard windows way would also benefit, and that would include the default browser picker in windows.
This feature would be fantastic!
I would find this very useful. I want to be able to open a website I'm working on in multiple different containers each with a different user account logged in for testing various workflows.
Agreed that this is a feature I'd love to have as well.
Even having the ability to open an "anonymous" container that only existed for the duration of the tab - on the command line, would be great. It would provide for some excellent integration into external apps. Or maybe add a way to put it into a URL as well - like https://anonymous+nouser:nopass@url where nouser and nopass don't exist.
While pjf said in his proposal:
I'd even be happy with a less-human-friendly version like needing to specify the container by index or uuid, since when I'm opening URLs using the cmdline it's almost always via a helper tool or script.
it is not true in general case and could lead to obscure errors (like a consequence of a change in the list of defined containers without an appropriate update of indexes in scripts).
As a profile name can be specified in command line the only logical and consistent way to implement this extremely useful feature is to allow to specify the container by its name. Of course, even such a limited solution is better than nothing :-) I would like to have also a way to specify a Temporary Container (like this https://addons.mozilla.org/en-US/firefox/addon/temporary-containers/), probably something what bhandeland proposed in the previous comment.
+1 this request. Loving the containers extension, would love to be able to do things like launch a specific set of sites into specific containers by running one simple script.
This would be great so I could open a new google doc from the command line either for work or personal:
# Google Docs
alias doc="open https://doc.new"
alias sheet="open https://sheet.new"
alias deck="open https://deck.new"
I have a use case where I have assigned multiple cloud accounts to different containers. I use a tool called aws-vault to login to each of these accounts. So if the firefox CLI has an option to pass the container name on which the URL needs to be opened, I can easily write a wrapper to open the different AWS accounts on the specific container, thus saving a lot of time opening a specific container and pasting in the URL
Came here for the exact same use case as @frezbo
It would be great to get this implemented \o/
Would be very handy since I'm having multiple AWS accounts and links to different accounts need to be open in different containers. Was thinking to alias it but turns out there is no such option...
It would awesome if this could also work with the -new-tab
option. Then on i3/Sway I could make a keyboard shortcut for opening a new tab in a specific container.
Hello everyone!
I created a separate extension for Firefox to do exactly what we all want in this thread. It might be not the best solution, but it does the job.
The idea is that my extension registers a custom protocol handler (ext+container
) to which you can easily pass different parameters (container name and some options in this case) alongside the real URL to be opened through the normal URI you invoke Firefox with. For example, like this:
firefox ext+container:name=Github&url=https://github.com
Also I made a shell script to simplify that a bit:
firefox-container -n Github https://github.com
You can install the extension from the official Mozilla repository and also find its source code, launcher script and a quick manual on its Github page.
I am open to your feedback, and I hope you like the extension.
Also I am open to collaborate with the authors of this extension, if they decide it's worth to include such functionality in it.
Have a nice day (or a peaceful night)!
@honsiorovskyi A great of of thanks, I accomplished what I was looking out for with this extension, for anyone this is the aws-vault helper I wrote:
function avl() {
FIREFOX="/Applications/Firefox.app/Contents/MacOS/firefox"
LOGIN_URL=$(aws-vault login --stdout "${1}")
[[ $? != 0 ]] && echo "${LOGIN_URL}" && return
ENCODED_URL="${LOGIN_URL//&/%26}"
URI_HANDLER="ext+container:name=${1}&url=${ENCODED_URL}"
"${FIREFOX}" "${URI_HANDLER}"
}
I also want to say thank you to @honsiorovskyi ! I have been waiting for something like this for a long time. I can finally set up my password manager to open different accounts on the same site in different containers.
I have groups in KeePass that correspond to the container I want to use. For example, the "Amazon Personal" entry is in the Personal group, and the "Amazon Business" entry is in the Work group. For each entry, under Properties -> Override URL, I set
cmd://{FIREFOX} ext+container:name={GROUP}&url="{URL}"
It works perfectly.
This is still an issue that i would like to have as a feature on firefox :)
This is an issue as the only way to get I can credentials/cookies is from CLI, however the only way to have multiple sites open is in Containers, that means one or the other fails unless you can open from the CLI.
Hello everyone!
I created a separate extension for Firefox to do exactly what we all want in this thread. It might be not the best solution, but it does the job.
Thanks for the "Open external links in a container" addon. I've made a Perl version of your shell script firefox-container
[1], with a few minor enhancements: tab completion, opening of multiple URLs, opening of a blank tab if URL is not specified.
[1] https://metacpan.org/pod/firefox-container
We're starting to triage and prioritize based on the number of +1 these issues get.
Hey, after 224 :+1: and 3+ years has this Feature been prioritized anywhere or since @honsiorovskyi (thank you sir!) has proposed his implementation you're not going to do anything?
Because would also be nice if this could work with Site-Specific Browser (--ssb) as well...
Having native support for this would be fantastic. Just expressing my interest even if this thread is now dead and buried. 👍🏼
Would be awesome to see this feature added. Automating workflows would be far easier with this natively supported
At the same page. This is a very requested feature
More than 4 years waiting for this useful feature 😞
Please, guys... I understand that UI is good for "most of the people", but don´t forget the CLI... I'm sure its as useful (or more) than the UI for a lot of us..