Webpage Workshop: Home » HTML language reference » Base URL

Base URL

This element is used to define URL to which all URLs on the page are relative to. It can only be used within the head element.

<base
    href="url"
    target="_blank | frame-name | _parent | _self | _top"**
>

Key:
‡ = Required attribute
** = Transitional only

Explanation of attributes

href: used to specify the URL to which all URLs are relative to.

target**: used to specify the target window that all links on the page should be opened in. Some of the values for this attribute are special in that they refer to specific frames, such as _blank (a new window), _parent (the parent frame), _self (the frame containing the link), and _top (the full browser window). Other values are used to target frames by the name defined in the frame element.

Event handlers

No event handlers are defined for this element.

Basic example

<base href="http://www.webpageworkshop.co.uk">

In the above code, the base URL is set to http://www.webpageworkshop.co.uk. This means that any relative links on the page will be relative to this URL, as will the source URLs for any images or other objects.

Compatibility

Description: Support of base URL and attributes in various browsers
Test Internet Explorer 6+ Netscape 4 Mozilla and Netscape 6+ Opera 6+ MSN TV (WebTV) Konqeuror 3.0+
Basic element support  Yes  Yes  Yes  Yes  Yes  Yes 
Attribute: href  Yes  Yes  Yes  Yes  Yes  Yes 
Attribute: target  Yes  Yes  Yes  Yes  Yes  Yes 

Key:
The browser icons are explained in the below list:
Internet Explorer 6+ = Microsoft Internet Explorer 6+
Netscape 4 = Netscape Communicator 4
Mozilla and Netscape 6+ = Mozilla and Netscape Navigator 6+
Opera 7+ = Opera 7+
MSN TV (WebTV) = MSN TV (aka. WebTV)
Konqeuror 3.0+ = Konqueror 3.0+