Jason BellamySep 21
Quit annoying your users
Start using custom HTML target attributes.
Occasionally we will want an external link to open up in a new tab. So we go ahead and add the following attribute to the link:
<a target="_blank" href="http://facebook.com">Facebook</a>
This is nothing exciting and works quite well, but there’s still the small problem where each and every time the user clicks on that link it’s going to open a brand new tab.
If we take a look at the spec for the target attribute we see that along with the “_blank”, “_self”, “_parent”, or “_top” keywords, it also accepts a custom string:
<a target="facebook" href="http://facebook.com">Facebook</a>
Using a custom keyword ensures that the first time a user clicks on that link it will open in a new tab, but each and every click after that will only focus the users browser on that original tab.