Update externallinks.js

This commit is contained in:
simonpipe 2026-05-28 09:24:49 +02:00
parent abd0a2d89e
commit 39c03d4eb6

View file

@ -1,9 +1,7 @@
document.addEventListener('DOMContentLoaded', function() { var links = document.querySelectorAll('a[href^="https://"], a[href^="http://"]');
var links = document.querySelectorAll('a[href^="https://"], a[href^="http://"]'); links.forEach(function(link) {
links.forEach(function(link) { if (!link.href.includes(window.location.hostname)) {
if (!link.href.includes(window.location.hostname)) { link.setAttribute('target', '_blank');
link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer');
link.setAttribute('rel', 'noopener noreferrer'); }
}
});
}); });