from Hacker News

ContainerScript: Firefox Addon for programmatically assigning URLs to containers

by 0x696C6961 on 12/2/24, 1:22 PM with 26 comments

  • by protoster on 12/2/24, 1:45 PM

    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.
  • by Ch00k on 12/2/24, 1:54 PM

    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.
  • by oriel on 12/2/24, 5:38 PM

    Hey 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/Web...

    [2] https://github.com/beardedspice/beardedspice

  • by konradkpl on 12/2/24, 1:45 PM

    There is a built-in possibility to assign URLs to containers: 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.

  • by worble on 12/2/24, 1:48 PM

    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.

    I've been using https://addons.mozilla.org/en-CA/firefox/addon/containerise to handle this for me.

  • by vfclists on 12/2/24, 2:06 PM

    Having 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.

  • by weberer on 12/2/24, 1:48 PM

    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?
  • by bluelightning2k on 12/2/24, 1:44 PM

    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?
  • by DemocracyFTW2 on 12/2/24, 3:27 PM

    Could someone explain to me what "container" means in this context and why would I want to use "containers" for URLs / domains?
  • by mhx1138 on 12/2/24, 4:02 PM

    This should be built in to Firefox. I would appreciate that functionality, but installing a rando‘s script in my browser seems risky.
  • by OutOfHere on 12/2/24, 2:27 PM

    I don't know why it's so difficult in Firefox to just run each URL domain in its own container unless instructed otherwise.
  • by M95D on 12/3/24, 12:42 PM

    How much longer until each site has its own container?