I'm looking for any suggestions on a direction to head to solve this 
problem.  I've tried "routeProvider" and "hashchange" but both only seem to 
deal with the path and parameters and not the domain name so I have not 
been able to get them to work with an external domain link - they ignore 
the host name. 

Problem:  
If a user is on domain1.com and clicks a links anywhere on the site where 
the link takes them to domain2.com, I want to call a JS function(for 
analytics) before sending then to the domain2.com link.

Below is the link to a JSFiddle that I was using as a playground area and 
the code below is in the Fiddle.  However id does not solve the problem I 
am having witht he 3rd link which is an external domain, it just ignores it.

Thank you for any asisstance!!!

JSFiddle: https://jsfiddle.net/genericperson/jLkzqfqe/


<a href="#newHash1">Hash1</a>
<a href="#newHash2">Hash2</a>
<a href="http://www.domain2.com#newHash3";>Hash3</a>

$(window).on('hashchange', function(e){
    var origEvent = e.originalEvent;
    //if ( origEvent.newURL == 'domain2.com' ){
      //  Analytics();
    // }        
    alert('Going to: ' + origEvent.newURL + ' from: ' + origEvent.oldURL); 
   
});

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to