/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName('a'); for each (anchor in anchors) { if (anchor.getAttribute('href') && anchor.getAttribute('rel') == 'external') { anchor.target = '_blank'; } } } window.onload = externalLinks; </script>