Connected: An Internet Encyclopedia
10. Appendix - Embedding the Base URL in HTML documents

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1808
Prev: 9. Author's Address

10. Appendix - Embedding the Base URL in HTML documents

10. Appendix - Embedding the Base URL in HTML documents

It is useful to consider an example of how the base URL of a document can be embedded within the document's content. In this appendix, we describe how documents written in the Hypertext Markup Language (HTML) [3] can include an embedded base URL. This appendix does not form a part of the relative URL specification and should not be considered as anything more than a descriptive example.

HTML defines a special element "BASE" which, when present in the "HEAD" portion of a document, signals that the parser should use the BASE element's "HREF" attribute as the base URL for resolving any relative URLs. The "HREF" attribute must be an absolute URL. Note that, in HTML, element and attribute names are case-insensitive. For example:

      <!doctype html public "-//IETF//DTD HTML//EN">
      <HTML><HEAD>
      <TITLE>An example HTML document</TITLE>
      <BASE href="http://www.ics.uci.edu/Test/a/b/c">
      </HEAD><BODY>
      ... <A href="../x">a hypertext anchor</A> ...
      </BODY></HTML>

A parser reading the example document should interpret the given relative URL "../x" as representing the absolute URL

      <URL:http://www.ics.uci.edu/Test/a/x>

regardless of the context in which the example document was obtained.


Connected: An Internet Encyclopedia
10. Appendix - Embedding the Base URL in HTML documents