Firefox Containers: Multiple (Gmail) Logins Through Privacy Isolation
To monitor web app performance and usage on any site (or just on your business-critical SaaS apps), take a look at our uberAgent product.
In a nutshell, Firefox Containers makes it possible to log in to a website with multiple different accounts at the same time. This is accomplished through data segmentation: cookies and other site data stay within the boundaries of a container.
Firefox Containers work with any web or SaaS app, but they are especially useful where you frequently need to switch identities. One example is a consultant accessing Azure Portal for different customers; another is … Gmail.
Gmail is remarkably bad at handling multiple simultaneous logins. Sure, you can log in to multiple Google accounts and switch accounts in the upper right corner of the Gmail UI. You can also open multiple Gmail tabs, one per account. This approach leaves several things to be desired, though:
- There is no visual indicator, i.e., a tab’s icon does not show which which Gmail account it hosts
- You can’t bookmark specific Gmail accounts, e.g. “Work Gmail”
- Gmail accounts may get mixed up when you need to reauthenticate
When you open multiple Gmail accounts in different tabs, Gmail adds a number to the URL to differentiate between accounts. In the example below, the account number is “2”:
The main problem is that these numbers are assigned in the order that you log on to Google accounts. The numbers are not tied to the actual accounts in any way. When Google asks you to reauthenticate, it is quite likely that you follow a different sequence. And voilà, the tab that used to show your work Gmail account now hosts your personal account and vice versa.
Let’s illustrate this with an example.
- Tab 1:
- Tab 2:
- Tab 3:
https://mail.google.com/mail/u/2/#inbox, sports club
- Tab 1:
- Tab 2:
https://mail.google.com/mail/u/1/#inbox, sports club
- Tab 3:
This also explains why you cannot bookmark individual Gmail accounts. Let’s assume your work account has currently been assigned the number “2”. When you add a bookmark to it, the browser stores the URL shown above. When you try to open the bookmark later, it may very well be the case that the number “2” now stands for your personal Gmail account.
This behavior significantly affects user experience and practically guarantees end-user confusion.
Firefox Containers was originally developed as a Facebook container and was later converted into a generic solution. It works by separating cookies, local storage and the browser cache between containers (details).
The coolest thing about Firefox Containers, apart from the fact that it “just works”, is the neat integration into the browser’s UI.
Container tabs are color-coded:
The address bar shows the current tab’s container name and color:
The documentation mentions a variety of use cases. Here are my favorites:
- Log in to a web app with multiple accounts at the same time
- Create “clean” environments for testing without having to resort to private mode or deleting the cache
- Isolate sites like Facebook to prevent tracking and improve privacy
Head over to the Firefox add-ons site and install the add-on Firefox Multi-Account Containers by Mozilla from there.
To open a new tab in a specific container press CTRL+. (control and period). This opens the containers panel below the add-on’s icon in the upper-right corner. Alternatively, press ALT+F and select New Container Tab from the menu.
To configure the browser to always open sites in the right container:
- Open a new container tab, e.g. “work” (see above)
- In the new tab, open the site you want to pin to the container
- Open the containers panel (see above) and select Always open in …
Starting with Firefox 73.0, the container configuration and site assignments are synchronized between computers (blog post). This requires a Firefox Sync account.
If this whetted your appetite and you would like to try out Firefox Containers for yourself, take a look at my follow-up article Switching from Chrome to Firefox.