Thank you for your quick reply. I want to track a link based on google search results.
It works in some cases as nomal but doesn't work on links that are google search results, eg https:// www.google.com.vn /?gws_rd=ssl#q=google+adwords.
I will try to reproduce problem step by step:
1. Install addon with handle event click following code.
function handleWindowClick(event) {
var origEl = event.target;
if(origEl.tagName == 'A') {
// do some things with event link: origEl.toString();
alert("Event Link: " + origEl.toString());
} else if(origEl.parentNode.tagName == 'A') {
alert("Event Link: " + origEl.parentNode.toString());
} else if(origEl.tagName == 'SPAN') {
alert("Span is clicked");
}
}
window.addEventListener('click', handleWindowClick, false);
Update based on your code you edited in:
function handleWindowClick(event) {
var origEl = event.target;
if(origEl.tagName == 'A') {
// do some things with event link: origEl.toString();
alert("Event Link: " + origEl.toString());
} else if(origEl.parentNode.tagName == 'A') {
alert("Event Link: " + origEl.parentNode.toString());
} else if(origEl.tagName == 'SPAN') {
alert("Span is clicked");
}
}
window.addEventListener('click', handleWindowClick, false);
ps: shame on the person voting to close your topic, just because you don't type english so well.