CoverYourASP --> Linking to external pages

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
11 active users
2303 visitors today
2004 pages today
(only part of today)
Tools I use

Copyright © 1999-2016 James Shaw.
All rights reserved.

RSS submissions

Now open source with SourceForge!

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?!

Featured sponsor
My favorite resources

See my source code
wherever you see this icon...

You can also download the entire site source code for FREE!

New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!