For some mysterious reason, some people make external links from their website open in a new window. This is a user unfriendly feature that good websites stopped using over ten years ago. But some clueless people still think forcing a new window is a good idea. I believe they think it is a way to keep people on their site to generate more sales or display more ads. What it does is annoy users. They may see the site for longer, but will have a less favorable opinion of it. If someone has a reason for opening a new window they’ll do it themselves, without a webmaster forcing it on them. It isn’t necessary to use a new window to keep people on your site, this is 2011, and everyone has figured out how to use the browser’s “back” feature. Since web design moved past the frames stage a decade ago, it isn’t necessary to continue using the target tag. Remember, using target="_blank" or a JavaScript equivalent is a bad idea.

Unfortunately, I just realized that one of the sites that I host was using lots of target="_blank" tags. This particular site uses a CMS with TinyMCE for editing. TinyMCE allows the user to choose the target for a link, and a large portion of the links had this turned on. The choice of target wasn’t consistent, so it was probably a case of the user randomly choosing an option. So I decided to remove the option.

I searched the source, and found where the target was being added. I also looked online for on official setting to remove this feature, but didn’t find one. I don’t know the canonical way to do this, but deleting a few lines from two files works well.

From tinymce/jscripts/tiny_mce/themes/advanced/link.htm delete the lines:

<tr>
	<td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>
	<td><select id="target_list" name="target_list"></select></td>
</tr>

From tinymce/jscripts/tiny_mce/themes/advanced/js/link.js delete the lines that include target_list.

The only problem I see is that these changes will have to be repeated every time you update the software. I suppose I could write a sed script to do this, but the TinyMCE code could change, and there has to be a cleaner official way get rid of the target.


Update: I ended up searching the entire database to remove all the target tags. The site with the target problem uses MySQL, so I just ran this command through MySQL:

UPDATE table_name SET column_name = REPLACE(column_name, 'target=\"_blank\"', '')

Caveat: I will occasionally use target="_top" on some links because there are still some sites that try to surround another site with ads.

Note: If you think you need to open a new window, I have a hint for that on my Cheat Sheet.