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