TargetChooser: Option-Tooltip for HTML-links

15
Jul

Recently, there was an article on SmashingMagazine which covered the topic whether links on websites should open in a new window. Personally, I almost always open links in a new tab unless I’m done with the current site. So if I’m reading an article on a website, I’m letting to open links in the background (tab) but I keep reading the main article — when I’m finished, I’ll check the opened links in order to read them carefully. But this is just a personal behavior — it’s always a matter of taste and it’s individual. The main reason, why I’m having links with the ‘open in new window’-property (target="_blank") is that I’m having internal and external links on this website. Only internal links will be opened in the same window while external links are opened in a new window.
So I’ve developed a small JavaScript based tooltip which generates two links (target="_blank" and target="_self") from a source link — the two links are displayed in a tooltip below the source link when you hover the cursor over it.
Targetchooser
So this script gives the user the options in what window the link will be opened. The script is lightweight and very easy to integrate. Download the script at first. Copy the files in your preferred website-folder and add the following line at the end of your HTML-code (before the </body>-tag):

<script type="text/javascript" src="targetchooser.js"></script>

Then just add the “name”-attribute (or “rel” but “name” works faster) to the links you want to use TargetChooser. This may look like this:

<a href="http://xshock.de" name="targetchooser">XSHOCK.de</a>

You can also force all links on your website to use TargetChooser. In order to this, simply open the “targetchooser.js” and edit the configuration (every line is commented so it’s quite easy). Additionally, you could add a “title”-attribute to your links (e.g. “Open in new window”) which will appear if JavaScript is disabled. If JavaScript is enabled, TargetChooser is active and overwrites the title (if set) so that it won’t overlay the TargetChooser-tooltip.
I hope you like this tool. I think it’s a good compromise for the “target problem”.

Article postedPosted in @ 07/15/08

Comments