Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


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="http://WDVL.Internet.com/index.html">
	     ...
<IMG SRC="Icons/logo.gif" 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="http://WDVL.Internet.com/WDVL/Tour.html">
</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="Tour.gif" alt="button">
becomes
<Img src="http://WDVL.Internet.com/WDVL/Tour.gif" 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




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers