JSFiddle - React, Tailwind, and code Playground
HTML
<div id="links">
<a href="http://fiddle.jshell.net/#foo">Inbound Link</a>
<a href="http://stackoverflow.com">Outbout Link</a>
</div>
JavaScript
var link_container = document.getElementById('links');
link_container.addEventListener('click', function(e){
if(e.target.nodeName === "A"){
var href = e.target.getAttribute('href'),
selfhost = window.location.hostname;
if(href.indexOf(selfhost) !== -1){
alert('Inbound link clicked');
} else {
alert('Outbound link clicked');
}
}
}, false);