BASE element | base object
[This documentation is preliminary and is subject to change.]
Specifies an explicit URL used to resolve links and references to external sources such as images and style sheets.
![]() |
Standards information
- HTML 4.01 Specification, Section 12.4
DOM Information
Inheritance Hierarchy
Remarks
When used, the base element must appear within the head of the document, before any elements that refer to an external source.
If more than one base element occurs, only the first element will be recognized.
Windows Internet Explorer 8 and later. When read, the value of the href attribute depends on the current document compatibility mode. In addition, relative URL's are no longer supported by the base element.
Note Versions of Windows Internet Explorer prior to Windows Internet Explorer 7 would allow the base element to appear anywhere in the document tree, which caused relative paths to use the "nearest" base element as the base for the URL. Internet Explorer 7 strictly enforces the use of the base tag within the head of the document, and will ignore misplaced tags.
Examples
This example sets the base URL of the document to a reference folder. Internet Explorer uses the base element to resolve the link to http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/href_2.asp.
<html> <head> <base href="http://msdn.microsoft.com/workshop/author/dhtml/reference/"/> </head> <body> Click <a href="properties/href_2.asp">here</a> to learn about the href property. </body> </html>
This example retrieves the base URL from the document if a valid base element is specified in the document. Otherwise, the function returns
null.
<script>
function GetBase()
{
var oBaseColl = document.all.tags('BASE');
return ( (oBaseColl && oBaseColl.length) ? oBaseColl[0].href :
null );
}
</script>
Build date: 3/8/2012
- 11/23/2009
- Mr. Raymond Kenneth Petry
- 11/23/2009
- Mr. Raymond Kenneth Petry
