Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MurzNN opened this issue Aug 19, 2015 · 8 comments
Open

Comments

@MurzNN
Copy link

MurzNN commented Aug 19, 2015

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 MurzNN changed the title Provice new phttp protocol for opening url links always in private tab Provide new phttp protocol for opening url links always in private tab Aug 19, 2015
@MurzNN
Copy link
Author

MurzNN commented Aug 19, 2015

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

@MurzNN
Copy link
Author

MurzNN commented Aug 19, 2015

I have found same feature request: #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
Copy link
Author

MurzNN commented Aug 19, 2015

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
Copy link
Author

MurzNN commented Aug 19, 2015

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

@Infocatcher
Copy link
Owner

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
Copy link

ghost commented Feb 10, 2016

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

@Infocatcher
Copy link
Owner

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 #187 (comment)).
Also here described limitations of used URI_DANGEROUS_TO_LOAD flag: #144 (comment)

@vertigo220
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants