Yes! I need this. I have a separate youtube container for background listening videos where I want the video quality to be set low. I want a container so that I don' t have to change quality back and forth when watching videos at full quality. Currently, I have to manually open a container tab and then navigate to the channel.
Does it support regular expressions to match parts of a URL? I have two different GitHub accounts, that I need to be able open in different containers based on the organization name (https://github.com/<org>). I am currently using https://addons.mozilla.org/en-CA/firefox/addon/containerise/, but it is a bit of a pain. I would much prefer defining my rules in code.
Yeah, it's JavaScript so you can write whatever logic you want!
if (url.hostname === "github.com") {
if (/.*foo.*/.test(url.pathname)) {
return "My Foo Conatiner"
}
if (/.*bar.*/.test(url.pathname)) {
return "My Bar Container"
}
}
I'm curious, for such a straight-forwarded added functionality, why you would:
1. add a very heavy editor framework (monaco) for a configuration page?
2. use actual javascript to check partial urls one at a time?
For 2. this would be better handled by a json or similar that just maps Firefox's approved url match patterns[1]? Using javascript adds potential execution vulnerabilities and possibly parsing complexity that isnt needed.
Also a word on partial urls. Given that many sites will use subdomains and redirects as a norm, expecting a site to be like "www.amazon.com" seems like it would generate a lot of excess code in order to maintain url targeting. This comes from working on a macOS plugin that did similar javascript injection based on url targeting (BeardedSpice[2]) and would have regular targeting errors, especially with more complex SPAs.
Either way, keep up the good work! Love to see projects like this attempt to improve the QoL around the browsing experience.
> 1. add a very heavy editor framework (monaco) for a configuration page?
It's a configuration page which requires editing code, so I added a code editor.
> 2. use actual javascript to check partial urls one at a time?
> For 2. this would be better handled by a json or similar that just maps Firefox's approved url match patterns[1]? Using javascript adds potential execution vulnerabilities and possibly parsing complexity that isnt needed.
Yep, this addon is for more advanced scenarios. For example, I have different AWS accounts open in a different containers and I want codebuild urls to open in the correct one depending on the project name.
While containers are a great feature, it's irritating that the official mozilla extension does have greater controls for controlling when pages get loaded into containers. For example Bandcamp has every artist on their own subdomain, which means even though bandcamp.com is set to open in its own container, none of the artists pages do.
It's TypeScript bundled with esbuild. I needed to minify the output because the monaco editor resulted in file sizes over the 4MB limit imposed on FF addons. The background script is here: https://github.com/icholy/ContainerScript/blob/master/backgr...
In the official Multi-Account Containers add-on, there's an option for "Always open this site in..." where you can chose a container. How does this differ?
Different containers for different paths on the same domain. Obviously not a common use case, but it's there. It's fully programmable, so you can open a different container based on the current phase of the moon if your heart desires it.
This is usually my type of thing but am I being thick, I don't quite get what this is for? Could we get a zoomed out example of addressing said container?
Firefox containers let you isolate browsing contexts. Think separate cookie jars. Example: You can have one container for work (logged into work Gmail, Slack) and another for personal (personal Gmail, Amazon). They won't share logins or tracking data.