★ wanayoo — archive 1999 http://wdvl.internet.com/Authoring/HTML/Head/base.htmlNouvelle recherche | Portail wanayoo
Swynk.com logo
internet.com
Join the free
WDVL newsletter!

home

HTML's BASE tag

A record of the original URL of the document: this allows you to move the document to a new directory (or even a new site) and have relative URLs access the appropriate place with respect to the original URL. If the BASE element is absent the document viewer assumes the base URL to be the one it used to access the document.

The BASE element gives the base URL for dereferencing relative URLs, using the rules given by the URL specification, e.g.

<BASE href="/old?u=http%3A%2F%2FWDVL.Internet.com%2Findex.html&y=1999">
	     ...
<IMG SRC="/old?u=http%3A%2F%2Fwdvl.internet.com%2FAuthoring%2FHTML%2FHead%2FIcons%2Flogo.gif&y=1999" ALT="WDVL logo">

The image is deferenced to

    http://WDVL.Internet.com/Icons/logo.gif
In the absence of a BASE element the document URL should be used. Note that this is not necessarily the same as the URL used to request the document, as the base URL may be overridden by an HTTP header accompanying the document.

Example

<Head>
  <Title>Interesting Pages on the Web</Title>
  <Base href="/old?u=http%3A%2F%2FWDVL.Internet.com%2FWDVL%2FTour.html&y=1999">
</Head>
The URL inside the href attribute points to the Tour.html itself. The server will strip off the "Tour.html" bit, to get the directory, and then complete relative URL's relative to that, e.g.
<Img src="/old?u=http%3A%2F%2Fwdvl.internet.com%2FAuthoring%2FHTML%2FHead%2FTour.gif&y=1999" alt="button">
becomes
<Img src="/old?u=http%3A%2F%2FWDVL.Internet.com%2FWDVL%2FTour.gif&y=1999" alt="button">
Doing this has the advantages that you can move a group of related files around without breaking links by just changing the BASE; and relative URL's make your HTML more readable, i.e. less clutter.

Note too that when you move over to another computer you just need to change the domain name in one place. Or, if you just move the one document, leave the BASE as it is, and it will still reference the relative URLs correctly.


Up to => Home / Authoring / HTML / Head


internet.com
e-commerce


Internet Trade Show List

Copyright 1999-2000 internet.com Corp. Legal Notices. Privacy Policy.

www.internet.com