External links in a new window

The 'target' attribute is deprecated and should not be used. Here is a quick and easy way to replicate that behaviour with javascript. I got the idea - well, I guess I nicked the idea - from Kevin Yank's article on Sitepoint. My script is a little bit shorter and I've cut out the explanation.

<a rel="external" href="http://tinyurl.com/rdefj">Kevin Yank's article</a>
function external() {
var as=document.getElementsByTagName('a');
 for (i=0; i<as.length; i++) {
  if (as[i].getAttribute('rel')=='external') {
   as[i].onclick=function() {
    return false;


2021-04-27 JbsdBossy says :

best canadian prescription prices https://onlinecanda21.com/ Kamagra Gold

Comment form

Please type the word 'England' here:

BB code available :

  • [b]...[/b] : bold
  • [it]...[/it] : italic
  • [q]...[/q] : quote
  • [c]...[/c] : code
  • [url=...]...[/url] : url