website/js/externalLinkHandler.js

8 lines
251 B
JavaScript
Raw Normal View History

2021-04-14 21:30:14 +02:00
document.onreadystatechange = function () {
document.querySelectorAll("a").forEach((element) => {
let href = element.href;
if(href.indexOf(location.hostname) === -1){
element.target = "_blank";
}
});
2021-04-14 21:30:14 +02:00
}