 in a recent project at work i had completed implementing a site and the client was reviewing it their company decided that they wanted all external links to open in a new window this is not a practice that i really like and others agree opening up new browser windows is like a vacuum cleaner sales person who starts a visit by emptying an ash tray on the customers carpet dont pollute my screen with any more windows thanks particularly since current operating systems have miserable window management if i want a new window i will open it myself jakob nielsen the top ten web design mistakes of 1999 breaking the back button is never a good thing but this article is not about that back to the site i was implementing i was really not interested in adding target= blank to every single external link so i came up with a better solution the solution the site was already using jquery for other functions so i figured that i should just use some of its powerfulness to make my life easier with a couple lines of code i solved my problem $ document ready function $ a href =http attr target blank check out the demo to see the results explanation if you know anything about attribute selectors that should look familiar to you basically it is saying apply the attribute target= blank to all links that begin with http really easy really powerful problem solved some may say it almost might be preferable to browse the site with javascript disabled so that the external links would just open in the same window but that debate is for another time 