HTML Tutorial: Lists
 

  Internal links are links to pages within the same website. I have a page in this website called duck.htm. To take a look at this we can set up a link

Duck with glasses

Let's take a look behind the scenes ........

<a href="duck.htm">Duck with glasses</a>

Well that's pretty staightforward:

The <a> tag to tell the browser hey, here comes a link.

The href="duck.htm" attribute to say here's where I want to go to

The </a> to tell the browser where the tag ends so that it can work out what text activates the link - in this case the workd Duck with glasses. 

But hold on - how does the browser know where to find the page duck.htm?

duck.htm isn't a full web address, or to use the proper term URL (Universal Resource Locator). http://www.yahooligans.com/content/games/index.html is an example of a full address.

So what's the catch? - Relative Addressing

First,  I want to cover some terminology which I'll need to refer to  in my explanation:

  • website - a collection of HTML pages and other elements such as image files, programs etc that make up a person or an organisation's website.
  • webserver or server - the name given to the computer that holds the website and runs web server software. Webservers send the HTML to browsers which then interpret the HTML TAGS and display the output on the screen.

In the above example href="duck.htm" there is no address, so the webserver will search for a page called duck.htm on the local website, i.e. the webserver will assume that duck.htm is within the same website as the page from which it is called - internal.htm in this case.  Furthermore its will know that the address is relative to where the page, from where the link is called is located - that is it will look for duck.htm in the same folder as is found internal.htm.  

So the rule here is that you don't need to use a full URL in your links, if the page you're linking to is within the same website. 

Why don't you try it out ...

 

 

Contrast this to external links.