Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Apr 17, 2014 5:15 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
Hi there,

I've had this issue for a few weeks(months?) now but haven't bothered to report it yet. It is fairly annoying, even though it is minor, but I figured I'd report it anyways as the solution is simple.

The linode homepage uses a tracking script on outgoing links. This is supposed to open in a new tab if it is opened with the ctrlKey or some metaKeys (I'm not sure what the metaKeys refer to). This is the code:
Code:
$("a").on('click', function (e) {
  var url = $(this).attr("href");
  if (e.currentTarget.host != window.location.host) {
    _gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
    if (e.metaKey || e.ctrlKey) {
      var newtab = true;
    }
    if (!newtab) {
      e.preventDefault();
      setTimeout('document.location = "' + url + '"', 100);
    }
  }
});


The issue with this is, that with Win 7 and Chrome it doesn't seem to catch the middle mouse button in all cases. This is the case for links that go to a different domain (e.currentTarget.host != window.location.host). So if you are on the homepage (linode.com) and click on "Log In" (manage.linode.com) the handler is used to open the link. However the middle mouse button isn't caught, while normally (without javascript) it can be used to open links in new tabs.
The code below (which checks e.which === 2, which is the middle mouse button) will fix that. It would be awesome if it could be included.

Code:
$("a").on('click', function (e) {
  var url = $(this).attr("href");
  if (e.currentTarget.host != window.location.host) {
    _gaq.push(['_trackEvent', 'Outbound Links', e.currentTarget.host, url, 0]);
    if (e.metaKey || e.ctrlKey || e.which === 2) {
      var newtab = true;
    }
    if (!newtab) {
      e.preventDefault();
      setTimeout('document.location = "' + url + '"', 100);
    }
  }
});


Thanks!


Top
   
PostPosted: Thu Apr 17, 2014 6:05 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Can confirm. Chrome on Win7, middle click on the login page opens in the same tab, instead of a new tab.


Top
   
PostPosted: Fri Apr 18, 2014 2:02 am 
Offline
Senior Member

Joined: Sat Sep 25, 2010 2:25 am
Posts: 75
Website: http://www.ruchirablog.com
Location: Sri Lanka
I have the same issue and its really annoying. Chromium on Ubuntu

_________________
www.ruchirablog.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group