expected behavior:
apple-click / ctrl-click / command-clicking a link on drupal.org should open the link in a background tab
this is my default browser behavior, and this is what happens on other websites

observed behavior:
command-clicking a link on drupal.org opens the link in a background tab
AND
opens the link in the active tab.
In other words, clicking a single link once opens the target in two tabs.

I'm not sure the best way to phrase this bug in a generic way, or if this is even the right queue.

Comments

AaronBauman’s picture

system info:
observed on
OSX 10.6

Safari 5.0.3 (6533.19.4)
AND
Chrome 9.0.591.102

awolfey’s picture

Also on Firefox/3.6.13 Win 7

laura s’s picture

I noticed this, too, and it's incredibly aggravating. I love lots of open tabs. And I love it when my browsers behave as expected. It say this is a usability issue. #tag?

apaderno’s picture

I just tested this on this page, and I cannot reproduce it.
The command-click opens the link in a new tab, and the new tab is placed in foreground; in any cases, the link is not open in the tab I am using to visualize the page containing the link.

Does this issue happen with specific links, or does it happen with the links to the user profiles too?

apaderno’s picture

Title: javascript on drupal.org overrides default browser behavior for command-click » Javascript on drupal.org overrides default browser behavior for command-click

Does it happen on browsers using GreaseKit (the equivalent of Greasemonkey for WebKit)?

apaderno’s picture

I just verified this issue by clicking on the link I posted on #1080250-7: Unwanted subscription to Brazil Group.
I verified it happens also on Mac OS X Lion beta, which comes with Safari 5.1.

tacituseu’s picture

Same problem Chrome 9.597.107 only external links affected, the culprit is ...

      // $Id: googleanalytics.js,v 1.9.2.8 2011/02/05 19:53:32 hass Exp $
      // ...

      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // ...
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
          // Mailto link clicked.
          // ...
        }
        else if (ga.trackOutgoing && this.href) {
          if (ga.trackOutboundAsPageview) {
            // Track all external links as page views after URL cleanup.
            // Currently required, if click should be tracked as goal.
            // ...
          }
          else {  // ... !!! H E R E !!!
            // External link clicked.
            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
  
            // First, delay the outbound click by a fraction of a second.
            // This delay will hardly be noticeable by the user, but it will provide the
            // browser more time load the tracking code. Without this method, it's possible
            // that a user can click on the outbound link before the tracking code loads,
            // in which case the event will not be recorded.
            // See http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55527
            setTimeout('document.location = "' + this.href + '"', 100);
          }
        }
      }

See #1057890: Prevent browsers default behavior if monitored links are clicked for a possible fix.

tacituseu’s picture

As a bonus it seems

  // See http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55527
  setTimeout();

breaks PHP syntax highlighting.

AaronBauman’s picture

Should this be in the Google Analytics queue then?

Also, fwiw, "api.drupal.org" is apparently considered an external link from drupal.org

apaderno’s picture

I have marked #1084794: problem with javascript and links in issues as duplicate of this report.

joachim’s picture

Subscribe.

sreynen’s picture

The problem seems to be this specific line in the JS:

setTimeout('document.location = "' + this.href + '"', 100);

That's assuming every click intends to set the location on the current document, but a command-click has a different purpose. This line only affects external links, not every link, so that might explain why not everyone is seeing the problem.

The purpose of this delay is to give Google Analytics time to track outbound links. I don't think it's possible to reliably initiate new tabs via JavaScript, so I think losing outbound link tracking might be the only way to restore standard browser behavior. Is that an option or is that data too valuable to lose?

Short of a solution, there's a workaround: control-click the link and select "Open in new tab" from the contextual menu.

Damien Tournoud’s picture

Project: Drupal.org site moderators » Google Analytics
Version: » 6.x-3.x-dev
Component: Other » Code

*sigh*

It's not the first time scripts from the Google Analytics module cause issues. Moving there.

hass’s picture

Status: Active » Closed (duplicate)

#1057914: Custom outbound link tracking with outdated link targets or javascript is broken, install latest DEV please :-(

It is the very *first* time in 3 years that GA have a real issue and I'm very sorry for that.

sreynen’s picture

Title: Javascript on drupal.org overrides default browser behavior for command-click » GA on drupal.org needs updating to resolve outbound link command-click problem
Project: Google Analytics » Drupal.org site moderators
Version: 6.x-3.x-dev »
Component: Code » Other
Status: Closed (duplicate) » Active

Moving back to webmasters queue so this can be resolved on drupal.org.

mr.baileys’s picture

This might be more of an infrastructure issue rather than a webmaster issue since it requires deploying code on drupal.org, not sure.

So I guess the options are:

  1. Install -dev (personally, I think we should stay as far away from dev releases as possible on drupal.org)
  2. Manually apply the patch from #1057914-14: Custom outbound link tracking with outdated link targets or javascript is broken to GA on do.
  3. Live with it and postpone this issue until a new version of GA is released.
  4. Disable outbound link tracking on do.

Option 3 takes my preference.

apaderno’s picture

I have marked #1097064: Middle click doesn't work as it should as duplicate of this report.

fuzzy76’s picture

Subscribing. What's holding back upgrading the module?

joachim’s picture

> [...] until a new version of GA is released

I don't see why the maintainer can't release a new version right now.

CVS branching used to hold us back for things like this when a module's branch would already have development changes and so you couldn't do a 1.1 hotfix for a major bug. This is no longer the case with git!

John Franklin’s picture

I concur with joachim. A google_analytics 6.x-3.2.1 release with critical patches pulled in is entirely appropriate.

naxoc’s picture

Subscribe

kenorb’s picture

greggles’s picture

I think we should do mr.baileys #4 - "Disable outbound link tracking on do."

greggles’s picture

Status: Active » Needs review

Nevermind my comment #23. Hass made the release: http://drupal.org/node/1108404

drumm’s picture

Status: Needs review » Fixed

Deployed google_analytics 6.x-3.3.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

joachim’s picture

Status: Closed (fixed) » Active

Reopening -- this is happening on the DrupalCon London site.

sreynen’s picture

Status: Active » Closed (fixed)

I think the London site probably needs a separate issue, so I made one: #1237044: london2011.drupal.org needs updating to resolve outbound link command-click problem