event handler prevents following link

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

event handler prevents following link

Post by trolly »

Hi,
the following event handler prevents following the link it is attached to. Does anyone have an idea why?

Code: Select all

this.trackExteralLink = function(event) {
  var $anchor = $(event.currentTarget);
  var url = $anchor.attr('href');
  // check if external link
  if (cnIvwHelper.checkIfExternalURL(url) === true) {
    var category = 'Outgoing Link';
    var action = 'click';
    // No Race Condition on new target ... just log the stuff.
    if (typeof($anchor.attr('target')) !== "undefined") {
      cnLog('Tracking External Click - in new Window');
      trackGAEvent(category, action, url, 0, false);
    } else {
      event.preventDefault();
      cnLog('Tracking External Click - in same Window');
      trackGAEvent(category, action, url, 0, false, (function() {
        setTimeout(function() {
          window.location = url;
        }, 200);
      }));
    }
  }
}


Page: http://www.glamour.de/glamunity/login
The link is

Code: Select all

<a href="http://www.glamour.de/login.php?do=lostpw" class="float-right">Passwort vergessen? &gt;</a>
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Dom1953
Posts: 52
Joined: July 24th, 2014, 6:02 am
Location: Australia

Re: event handler prevents following link

Post by Dom1953 »

Hi Trolly,
Unfortunately this worked for me. Clicking the forgotten password link took me to the lost password page. This more or less immediately replaced itself with the main site home page. Clicking a menu item, Videos, again took me to a login page which, this time, replaced itself with the Videos page. Am I seeing the login/password page because of a slower network and/or PC perhaps?
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: event handler prevents following link

Post by trolly »

You had JS enabled? Then maybe an addon causes the malfunction.

Thanks for the report.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Dom1953
Posts: 52
Joined: July 24th, 2014, 6:02 am
Location: Australia

Re: event handler prevents following link

Post by Dom1953 »

Yes to JS enabled. FWIW, today the "login.php?do=lostpw" link is serving up the forum main page immediately with no intermediary forgotten password page. The address bar and page history, however, both show the lost pw URL as the page address. I assume you know about this.

You're welcome.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: event handler prevents following link

Post by trolly »

No, I didn't. When I click the link with JS disabled I get the lost pw page.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Dom1953
Posts: 52
Joined: July 24th, 2014, 6:02 am
Location: Australia

Re: event handler prevents following link

Post by Dom1953 »

I've retested with cleared caches and javascript both enabled and disabled and closing Firefox between changes.

It seems I was not recognizing the lost password page properly. I now do, after applying my limited German more fully with help of page visuals. My sincere apologies for this confusion.

What I can reproduce is that clicking the lost pw link navigates to the lost password page, irrespective of whether javascript is enable or disabled in my running of Firefox.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: event handler prevents following link

Post by trolly »

Ok.
Thanks.

I guess I have to examine my addons.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
Post Reply