Andy McKay

Oct 04, 2006

Inserting target="_blank"


A client asked us to change the external links on their website. There were links to external url's and the links had target="blank" on them, inserted by the authors of the content. So the client asked us to remove that target and instead add it by JavaScript, in this case the JavaScript relied upon the link having a rel="external". For those of you who don't know by the way, this is possible by uncommenting one line of JavaScript in Plone. All well and good, but being the sort of person I am, I have to ask why. The reason? Accessibility.


And that's when I got confused. Why does inserting that target through JavaScript improve accessibility for anyone? I can see it maybe being more valid. The only reason on #plone that anyone could think of was that if screenreaders ignore the JavaScript, they won't have new windows opening and that's more helpful. Googling for this case only pointed me to lots of sites where people said target="blank" should be present in the HTML and not added in JavaScript to ensure it works for users with scripting disabled. Which is the opposite of what is being done.

 Please send you answers on a post card and preferably they shouldn't be blank. I'll add that in later.