website/js/externalLinkHandler.js
2021-07-31 20:40:50 +02:00

8 lines
No EOL
251 B
JavaScript

document.onreadystatechange = function () {
document.querySelectorAll("a").forEach((element) => {
let href = element.href;
if(href.indexOf(location.hostname) === -1){
element.target = "_blank";
}
});
}