Page MenuHomePhabricator

CRM. Middle and right click on a link in conversations with Mozilla Firefox
Open, NormalPublic

Description

I always set up many links in my references, but links on https://crm.commishes.com/ does not work correcly in Mozilla Firefox. They redirect user if he used middle or right click on a link. But it is very wrong way, because you are breaking user experience. Right click should open context menu, middle click should open link on other tab in browser

I know what are you trying to do, you are trying to hide reference URL because sometimes it contains unique seed
https://crm.commishes.com/task/show/123456/?s=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is good decision, but you use wrong way to do it.

I just checked, middle/right clicks does not redirect me if I use Google Chrome. As I could see you use this to handle clicks.

if (document.addEventListener) { document.addEventListener('click', listener, false); }
else                           { document.attachEvent('onclick', listener); }

It means if I use middle/right click in Google Chrome, I will not use your /redirect/?url, so my URL will be seen as Referer: ...

In my ECM, where URLs contain family and given names of our clients I just fix all external url with JavaScript. In first my users go to /goto/XXXXXXXXXX (like /redirect/ in your system), and then to https://anon.to/?https://example.com

In my ECM I use something like that

'use strict';

$(document).ready(function () {
    const r = new RegExp('^([a-z0-9]+:)?//');
    $('a[href]').each(function () {
        if (r.test(this.href) && (this.host !== document.location.host)) {
            this.href = '/redirect/?url=' + encodeURIComponent(this.href);
            this.target = '_blank'; // I prefer to open external link in new tab everytime
        }
    });
});

And so I just change all links in advance.

Posted on GitHub by nokitakaze

Event Timeline

sebastian triaged this task as Normal priority.Mar 19 2020, 12:25 PM
sebastian created this task.
sebastian created this object with visibility "Public (No Login Required)".
sebastian created this object with edit policy "Administrators".