Automatically choose a Firefox Container when visiting selected domains.
Container Redirect is a lightweight Firefox extension that prompts you to choose a Firefox Container whenever you navigate to a domain you've configured.
It is designed for people who use Firefox Multi-Account Containers and want certain websites to always be opened in a specific container without having to manually switch containers first.
-
Domain-based container prompts Configure any number of domains that should trigger the container picker.
-
Native Firefox Containers Uses Firefox's built-in contextual identities rather than implementing a separate container system.
-
One-click container selection Displays your available containers directly in the page so you can choose where the site should open.
-
No forced container mapping You decide which container to use every time a watched domain is visited.
-
Persistent domain configuration Watched domains are stored using Firefox extension storage and survive browser restarts.
-
Domain normalization Inputs such as
https://www.example.com/are normalized toexample.com. -
Redirect-chain handling The extension avoids repeatedly displaying the picker during multi-step redirects such as authentication and SSO flows.
-
Same-document navigation protection SPA navigation using
history.pushState()/replaceState()does not unnecessarily trigger the picker again. -
Privileged-page navigation fallback Includes a secondary navigation safety net for cases where Firefox does not expose a navigation through the normal request interception path.
-
Session-scoped navigation exemptions Once the extension has opened a watched domain in a selected container, that tab is not immediately intercepted again for the same domain.
-
Minimal and local Configuration is stored locally in the browser. The extension does not require a remote backend.
The extension watches top-level HTTP and HTTPS navigations.
When a request matches one of your configured domains, Container Redirect interrupts the normal navigation and presents a container selector.
For example:
You configure:
github.com
chatgpt.com
example.com
You visit:
https://chatgpt.com/
Container Redirect:
┌─────────────────────────────────┐
│ Open chatgpt.com in: │
│ │
│ ● No Container │
│ ● Personal │
│ ● Work │
│ ● Development │
│ │
│ ✕ Cancel │
└─────────────────────────────────┘
After you choose a container, the target URL is opened in a new tab using that container's cookieStoreId.
This makes it possible to keep accounts, cookies, sessions, and browsing contexts separated using Firefox's native container system.
https://addons.mozilla.org/en-US/firefox/addon/container-picker/
After installing the extension:
Click the Container Redirect toolbar icon.
Enter a domain such as:
github.com
Then click Add.
The input is normalized automatically, so these will resolve to the same domain:
github.com
www.github.com
https://github.com/
https://www.github.com/some/path
Navigate to the configured domain normally.
Container Redirect will present a container picker.
Choose one of your Firefox Containers.
The destination will then open in the selected container.
Open the extension popup and click the × button next to a watched domain.
Watch:
google.com
github.com
slack.com
notion.so
Then choose your Work container whenever one of those domains is opened.
Watch:
accounts.google.com
login.microsoftonline.com
auth.example.com
This can help keep authentication cookies isolated from your normal browsing environment.
Watch:
chatgpt.com
claude.ai
gemini.google.com
Then open them inside a dedicated AI or Work container.
Container Redirect is intentionally small and dependency-free.
┌──────────────────────────────┐
│ Firefox Browser │
└──────────────┬───────────────┘
│
▼
┌─────────────────┐
│ background.js │
│ │
│ Domain matching │
│ Navigation │
│ Redirect logic │
│ Container APIs │
└───────┬─────────┘
│
┌──────┴───────┐
▼ ▼
┌─────────────┐ ┌─────────────┐
│ popup.js │ │ content.js │
│ │ │ │
│ Domain list │ │ In-page UI │
└─────────────┘ └──────┬──────┘
│
▼
┌─────────────┐
│ picker.js │
│ │
│ Container │
│ selection │
└─────────────┘
| File | Purpose |
|---|---|
manifest.json |
Extension metadata, permissions, scripts, icons, and Firefox configuration |
background.js |
Core navigation interception and container orchestration |
popup.html |
Extension popup UI |
popup.js |
Watched-domain management |
popup.css |
Popup styling |
content.js |
Injected container-selection banner |
content.css |
In-page prompt styling |
picker.html |
Fallback/full-page container picker |
picker.js |
Container picker logic |
picker.css |
Picker styling |
icons.js |
Firefox container icon rendering |
background.js |
Navigation, redirect, exemption, and message routing |
icons/ |
Extension icons |
The normal flow looks like this:
User navigates to a URL
│
▼
Is it HTTP/HTTPS?
│
▼
Does the domain match
a watched domain?
│ │
No Yes
│ │
▼ ▼
Continue Check exemptions
normally │
▼
Intercept navigation
│
▼
Show container picker
│
┌─────────┴─────────┐
▼ ▼
User cancels User selects
container
│
▼
Open target in new tab
using cookieStoreId
Container Redirect contains additional logic specifically to avoid false-positive prompts.
Some websites perform multiple HTTP redirects before reaching the final destination.
The extension tracks redirect chains so that one navigation does not repeatedly trigger the container picker.
Modern websites frequently change the URL using the History API without performing a full page navigation.
Container Redirect tracks:
history.pushState()
history.replaceState()
and fragment navigation to prevent these URL changes from being mistaken for a fresh visit.
Once a tab has been assigned to a container for a watched domain, the extension keeps that tab/domain combination exempt while the tab remains open.
This prevents a normal refresh from immediately reopening the picker.
Some Firefox-origin pages such as:
about:newtab
about:blank
do not always behave like normal web pages from the perspective of webRequest.
Container Redirect therefore includes a tabs.onUpdated safety net for navigation events that may bypass the normal request interception path.
The extension requests the following Firefox permissions:
contextualIdentities
cookies
webRequest
webRequestBlocking
webNavigation
tabs
storage
It also declares:
<all_urls>
| Permission | Reason |
|---|---|
contextualIdentities |
Read Firefox Containers and obtain their cookieStoreId values |
cookies |
Required for container/cookie-store integration |
webRequest |
Detect navigations to watched domains before they complete |
webRequestBlocking |
Cancel a matching navigation so the extension can redirect it into a container flow |
webNavigation |
Detect same-document navigation and improve navigation handling |
tabs |
Create, update, inspect, and close tabs |
storage |
Persist watched domains and session navigation state |
<all_urls> |
Allow the extension to inspect navigations to arbitrary user-configured domains |
The extension does not currently require a remote server or third-party API.
Container Redirect is designed to operate locally inside Firefox.
Watched domains are stored using:
browser.storage.localTemporary navigation state is stored using:
browser.storage.sessionThe extension does not need to send browsing data to an external service.
The manifest also declares no required data collection:
"data_collection_permissions": {
"required": [
"none"
]
}For complete privacy/security claims, review the current source code and Firefox extension manifest before publishing.
The extension is configured for:
Firefox 115+
as specified by:
"strict_min_version": "115.0"It relies on Firefox-specific APIs such as:
browser.contextualIdentitiesso Firefox is the primary target browser.
Potential future improvements include:
- Persistent domain → container rules
- Optional default containers per domain
- Wildcard/subdomain rules
- Import/export of configuration
- Better domain validation
- Context-menu integration
- Keyboard shortcuts
- Firefox Add-ons publishing
- Automated extension testing
- More granular per-domain behavior
- Optional "always use this container" mode
- Improved first-run onboarding
This project is licensed under the MIT License.
Built for Firefox users who rely on Firefox Multi-Account Containers.
Uses Firefox WebExtensions APIs and the Firefox contextualIdentities API.
Container Redirect is an independent open-source project and is not affiliated with or endorsed by Mozilla.
Firefox and Firefox Multi-Account Containers are trademarks of Mozilla.