|I recently realised that I had been a little lax with my HTML when using the anchor <a> tag - the tag that made HTML such a success by allowing hyperlinks to other documents.|
Most people just use the basic attribute - href - to specify the URL (Uniform Resource Locator) of the destination document.
But there are other important attributes that you should use - accesskey, tabindex, title and target. I still don't use the first two, but I should - they give keyboard access to your hyperlinks.
Using title - a core attribute that can be used with most tags - is interpreted by IE as a tooltip. So users who hover their mouse over a link get a better description.Try it
The target attribute is what prompted this article - I realised that everyone who clicks on a link to another site may not come back!
Using target="NewWindow" means that the external links will be opened in the browser window called "NewWindow" - and one is created if it doesn't already exist.Try it
Click on the link again - the new window exists this time, so it's re-used. Cool, huh?
One important point to note: opening browser windows has justifiably got a VERY bad name. Many sites will open many new windows to trap you in their site (we know who these people are, right?).
I justify my use because I always open the same named window, CYAExternal, so the most you'll ever have is two windows open.
But you could say I was doing it to make it easier for the readers -what do you think?!