Does IE not support the base tag?

15,134

Solution 1

IE has always supported <base href>. By the specifications, it has always been defined only when the href value is an absolute URL, though some browsers have had interpreted it even in the case of a relative URL. It must be placed in the <head> part of the document; otherwise browsers may ignore it. The base address can only be set once in a document. (If this is violated, browsers tend to ignore all but the first of them.)

In this case, my guess is that there is some character, outside any tags, before the <base> tag. Consider this:

 <base href="http://domain.net/qu/en/" />
<a href="sample">Sample Link</a>

This is invalid because of the no-break space character before the <base> tag. In HTML parsing, the no-break space, which is not a whitespace character, implicitly closes the <head> element and opens the <body> element. This means that the <base> tag would now be in the <body>. Some browsers may still accept it, but as the document cited in Tieson T’s answer says: “Internet Explorer 7 [and newer] strictly enforces the use of the base tag within the head of the document, and will ignore misplaced tags.”

To check things out, use a validator—it will among other things report problems like this.

Solution 2

According to Microsoft, IE 7 and newer do: http://msdn.microsoft.com/en-us/library/ms535191%28v=vs.85%29.aspx

Share:
15,134

Related videos on Youtube

HyderA
Author by

HyderA

Updated on June 04, 2022

Comments

  • HyderA
    HyderA almost 2 years

    I am unclear on IE's support for the <base> tag. Some articles suggest that it only works with an absolute href path. But it won't work for me.

    <base href="http://domain.net/qu/en/" />
    
    <a href="sample">Sample Link</a>
    

    On chrome and FF, clicking on the link will take me to http://domain.net/qu/en/sample but in IE9, it's taking me to http://domain.net/qu/sample

    I tried this with a relative <base> as well, and it doesn't appear to work.

    I have only tested this in IE9.08