View Single Post
Old 2012-09-15, 01:46 PM   #14
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
Quote:
Originally Posted by Greenie View Post
cd34 wrote up this handy bit of code to open all external links in a new window/tab

Code:
<script type="text/javascript">
<!--
var localdomain='link-o-rama.com';
var hrefs = document.getElementsByTagName("a");
for (var i=0, max=hrefs.length; i<max; i++) {
  if (hrefs[i].href.indexOf(localdomain) == -1) {
    hrefs[i].target='_blank';
  }
};
// -->
</script>
Just change link-o-rama.com to your domain & put this above the </body> tag
Thanks for that bit of code. I have a good use for it.
Maj. Stress is offline   Reply With Quote