4 ms·
ContainerScript: Firefox Addon for programmatically assigning URLs to containers
- bluelightning2k 2y agoThis 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?
- cuanim 2y agoI think it just auto opens a container according to the URL. So if url == 'amazon.com' then switch container of tab to shopping.
- konradkpl 2y agoThere is a built-in possibility to assign URLs to containers: https://konradkruk.com/images/CleanShot%202024-12-02%20at%2014.40.29%402x.png https://konradkruk.com/images/CleanShot%202024-12-02%20at%20... However, there is no possibility to adjust matching rules, so this script offers a bit more customization options.
- TonyTrapp 2y agoThat icon isn't showing up here. Are you sure it isn't coming from another add-on?
- 0x696C6961 2y agoYep, 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.
- protoster 2y agoYes! 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.
- worble 2y agoWhile 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. I've been using https://addons.mozilla.org/en-CA/firefox/addon/containerise https://addons.mozilla.org/en-CA/firefox/addon/containerise to handle this for me.
- weberer 2y agoIn 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?
- protoster 2y agoDifferent 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.
- deleted 2y ago[deleted]
- Ch00k 2y agoDoes 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> https://github.com/<org>). I am currently using https://addons.mozilla.org/en-CA/firefox/addon/containerise/ 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.
- 0x696C6961 2y agoYeah, 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" } }
- vfclists 2y agoHaving viewed the code by the CRX addon I'd like to ask - Was all or part of the program written in another language and compiled to Javascript? My Javascript is not the good but it looks that way to me, or perhaps was constructed from some table driven system.
- 0x696C6961 2y agoIt'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/background.ts https://github.com/icholy/ContainerScript/blob/master/backgr...
- OutOfHere 2y agoI don't know why it's so difficult in Firefox to just run each URL domain in its own container unless instructed otherwise.
- 0x696C6961 2y agoYou could accomplish that with ContainerScript like this: return url.hostname; But your container list would get pretty messy.
- OutOfHere 2y agoThe thing is... this should be the default. There should be no list for this default. The list should exist only when a deviation from the default is required. There definitely are use cases for it.
- ReadCarlBarks 2y agoThat'd be pointless, since Firefox already isolates third-party cookies and site data by default now.
- DemocracyFTW2 2y agoCould someone explain to me what "container" means in this context and why would I want to use "containers" for URLs / domains?
- 0x696C6961 2y agoFirefox 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.
- mhx1138 2y agoThis should be built in to Firefox. I would appreciate that functionality, but installing a rando‘s script in my browser seems risky.
- 0x696C6961 2y ago> This should be built in to Firefox. That would be great.
- oriel 2y agoHey this is a really cool idea. 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] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web... [2] https://github.com/beardedspice/beardedspice https://github.com/beardedspice/beardedspice
- 0x696C6961 2y ago> 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. There are other addons which work like that: * https://addons.mozilla.org/en-CA/firefox/addon/containerise/ https://addons.mozilla.org/en-CA/firefox/addon/containerise/ * https://addons.mozilla.org/en-CA/firefox/addon/multi-account-containers/ https://addons.mozilla.org/en-CA/firefox/addon/multi-account... This addon is for more complex use-cases. For example: return url.searchParams.get("x-SessionName");
- M95D 2y agoHow much longer until each site has its own container?