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

Ctrl+click redirects in current tab for outgoing links #267

Open
Bahm opened this issue Feb 3, 2021 · 1 comment
Open

Ctrl+click redirects in current tab for outgoing links #267

Bahm opened this issue Feb 3, 2021 · 1 comment
Labels

Comments

@Bahm
Copy link

Bahm commented Feb 3, 2021

In all major browsers, ctr+click opens a link in a new tab, but on the Nim website it also redirects the current tab if it's an outgoing link. The same happens with ctrl+enter (when a link is selected).

The problem occurs because of the following line in the code below: 'hitCallback': function(){document.location = url;}

    (function(){
      function setTracking(a) {
        var url = a.href;
        a.onclick = function() {
          if (typeof(ga) !== "undefined") {
            ga('send', 'event', 'outbound', 'click', url, {
              'transport': 'beacon',
              'hitCallback': function(){document.location = url;}
            });
          }
        };
      }

      var a = document.getElementsByTagName("a");
      for (var i = 0; i < a.length; ++i) {
        if (a[i].hostname != location.hostname &&
            a[i].getAttribute("target") !== "_blank"
        ) {
          setTracking(a[i])
        }
      }
    })();
@Calinou Calinou added the bug label Feb 3, 2021
@dom96
Copy link
Contributor

dom96 commented Feb 3, 2021

I'd say we can remove this tracking. I don't think we use the data from it really.

@yglukhov added it a while back IIRC, let us know if you have any objections :)

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

No branches or pull requests

3 participants