Facebook's fbclid Killer

Get rid of Facebook's fbclid tracking

< Feedback on Facebook's fbclid Killer

Review: OK - script works, but has bugs

§
Posted: 2019-10-05

not works for middle click

the code below works for middle click

$(document).on("mousedown",'a', function (e1) {
    $(document).one("mouseup",'a', function (e2) {
        if (e1.which == 2 && e1.target == e2.target) {
            var fbLink = this.href;
            var index = fbLink.search(/fbclid/);
            if(index != -1){
                event.preventDefault();
                var originalLink = fbLink.substring(0, index-1);
                this.href = originalLink;
                var e3 = $.event.fix(e2);
                e3.type = "middleclick";
                $(e2.target).trigger(e3);
            }
        }
    });
});

then combine your original code

Post reply

Sign in to post a reply.