Infocatcher / Private_Tab

Adds private tabs, restartless extension for Firefox (20.0+) and SeaMonkey (2.17+)
https://addons.mozilla.org/addon/private-tab/
Other
86 stars 20 forks source link

Provide new phttp protocol for opening url links always in private tab #187

Open MurzNN opened 9 years ago

MurzNN commented 9 years ago

Our company use intrenal corporate system with many urls to external services. Most of them we must open in private tabs. At now we must always don't forgot to do right click on link and select item "Open in private tab". We want find the way for mark some url links on our pages to always open in private tabs.

Good solution will be provide to Firefox new special protocol for opening links in private tabs. So instead of http://example.com - type something like phttp://example.com (private http) and when user click on this type of link - it opens always in private tab and redirects to http://example.com, and same phttps:// for https:// links.

Registering new protocol in Firefox is not so hard: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler

Will be good to see this feature in this extension, or in separate extension. What do you think about this idea?

MurzNN commented 9 years ago

I already try to do links like "private:http://example.com" - they works in url bar, but not works in page links.

MurzNN commented 9 years ago

I have found same feature request: https://github.com/Infocatcher/Private_Tab/issues/144 so this feature will be useful, but seems that we don't know how to implement it.

I'll try to search some solutions. At now I have found extension https://addons.mozilla.org/en-US/firefox/addon/fosdem-basic-protocol-handl/ that do something like this, and this articles: https://mike.kaply.com/2011/01/18/writing-a-firefox-protocol-handler/ http://www.roberthorvick.com/2009/07/03/adding-a-custom-protocol-to-firefox-for-easy-erlang-docs/

MurzNN commented 9 years ago

And here is my workaround (for Linux):

  1. In about:config create new boolean values: network.protocol-handler.expose.phttp = false network.protocol-handler.expose.phttps = false
  2. Create shell script that accept url and open firefox private tab with it, I place it in /usr/local/bin/firefox-private-link.sh (don't forget to mark it as executable) with content:
#!/bin/bash
URL=`echo $1 | sed 's/^phttp/http/'`
exec firefox private:$URL
  1. Create page with phttp:// and phttps:// links, click on them. Firefox will ask to select application for open its, we type path to our script /usr/local/bin/firefox-private-link.sh and checkbox "Remember my choice".
  2. After this all phttp:// and phttps:// links will always open new private tabs without any additional links.
MurzNN commented 9 years ago

Maybe we can intercept those links with firefox extension, and don't use external script?

Infocatcher commented 9 years ago

And here is my workaround (for Linux):

Interesting, thanks for investigation.

But the main problem is to prevent things like

var win = window.open("p" + location.href); // Open the same page in private mode
win.addEventListener("load", function onLoad(e) {
    win.removeEventListener(e.type, onLoad, true);
    alert(win.document.cookie); // Try get private data
}, true);

Should be called from something like <a onclick="..."> on page or just temporarily disable "Block pop-up windows" option.

So, used URI_DANGEROUS_TO_LOAD flag in protocol implementation to forbid communications between private and non-private tabs. And as a side-effect even tab opening will be forbidden.

ghost commented 8 years ago

So for clarification, will this ever be an option? Opening private tabs from non-private tabs?

Infocatcher commented 8 years ago

So for clarification, will this ever be an option? Opening private tabs from non-private tabs?

May be... But only if will work for user actions and not for page scripts (to prevent things like https://github.com/Infocatcher/Private_Tab/issues/187#issuecomment-136300836). Also here described limitations of used URI_DANGEROUS_TO_LOAD flag: https://github.com/Infocatcher/Private_Tab/issues/144#issuecomment-43435945

vertigo220 commented 8 years ago

This sounds similar to what I'm trying to accomplish. I'm trying to force certain URLs in KeePass to open in a private window/tab. It appears doing so via the command line is not possible, but in trying to figure out how to make it work I found this addon; however, it gives me an error when I insert "private:" before the URL in KeePass ("Unknown error 0x80041002" if it helps). I'm using Pale Moon, but the functionality should be identical to Firefox.