From 0b391bf37f4cd301352bc53b72462387307ad3d6 Mon Sep 17 00:00:00 2001 From: simonpipe Date: Thu, 28 May 2026 08:31:18 +0200 Subject: [PATCH] Add externallinks.js --- externallinks.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 externallinks.js diff --git a/externallinks.js b/externallinks.js new file mode 100644 index 0000000..024d569 --- /dev/null +++ b/externallinks.js @@ -0,0 +1,9 @@ +document.addEventListener('DOMContentLoaded', function() { + var links = document.querySelectorAll('a[href^="https://"], a[href^="http://"]'); + links.forEach(function(link) { + if (!link.href.includes(window.location.hostname)) { + link.setAttribute('target', '_blank'); + link.setAttribute('rel', 'noopener noreferrer'); + } + }); +}); \ No newline at end of file