philc / vimium

The hacker's browser.
https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb
MIT License
23.56k stars 2.49k forks source link

Firefox Multi-Account Containers - new command to open link in default container or specified container #3219

Open j86989 opened 5 years ago

j86989 commented 5 years ago

Hi,

By default Firefox opens links in new tabs in current container.

Let's assume there is Firefox container for Facebook.

If an user opens links on Facebook website in new tab with LinkHints.activateModeToOpenInNewTab Vimium command, the new tab will open inside Facebook container.

In my opinion it doesn't help if you want to prevent Facebook from tracking your activity.

By the way, if you open new empty tab in container, Firefox opens it outside of containers by default. However, if you use createTab Vimium command in container to open empty tab, new tab is opened inside of that container.

gdh1995 commented 5 years ago

Vimium use browser.tabs.create to open new tabs, which doc is https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create . So, up to 2019-01-09, there seems no way to specify a container when ceating a new tab.

As for LinkHints.activateModeToOpenInNewTab, it's because Firefox's popup blocker is too-strict that Vimum has to use backend's tabs.create, but not element.dispatchEvent(new MouseEvent("click", ...)), to ensure the link will be opened on a new tab. While on other browsers like Chrome, dispatchEvent works as expected.

Considering this container issue, this behavior may need a review.

j86989 commented 5 years ago

Thanks for explanation.

The containers seem to be underrated experimental feature that could work behind the scene... Maybe there's will be a way to handle Firefox containers programmatically in the future.

jlevitt commented 5 years ago

This would be great! Right now, it his hard to use vimium with containers... it usually doesn't do the right thing. Let me know if I can help out in any way.

hackel commented 4 years ago

The Multi-Account Container extension now allows you to restrict a container to only those domains added to it. With this setting enabled, if you try to open a link from a container to an external site, it will open in the designated container or "No Container", even with Vimium. This is great.

Unfortunately Vimium still opens new tabs in the same container you're in, unlike Ctrl-T, which always opens them in "No Container".

azzamsa commented 3 years ago

I use honsiorovskyi/open-url-in-container to open links from my daily bash script.

firefox-dev 'ext+container:name=leisure&url=https://twitter.com/'

The README stated:

This is a Firefox extension that enables support for opening links in specific containers using custom protocol handler. It works for terminal, OS shortcuts, bookmarks, password managers, regular HTML pages and many other things.

Maybe we can combine its capability with Vimium. To make Vimium able to open a new link in a specified container. Or to learn from its codebase.

gdh1995 commented 3 years ago

Well, the extension requires two new permissions: cookies and contextualIdentities.