JSFiddle - React, Tailwind, and code Playground
HTML
<a href="http://google.com">Google</a>
<br><br>
<a href="/">JSFIDDLE</a>
JavaScript
var hostRegExp = new RegExp(location.host);
$(document).on('click', 'a', function(e)
{
e.preventDefault();
var href = this.href;
window.open(href, hostRegExp.test(href) ? '_self' : '_blank');
});