Does IE support a base tag?

Unclear, IE support for the <base> . Some articles suggest that it only works with an absolute href loop. But that will not 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 lead me to http://domain.net/qu/en/sample , but in IE9 it will lead me to http://domain.net/qu/sample

I tried this with relative <base> and it doesn't seem to work.

I tested it only in IE9.08

+8
html internet-explorer meta-tags hyperlink
source share
2 answers

IE always supported <base href> . According to the specifications, it was always determined only when the href value is an absolute URL, although some browsers interpreted it even in the case of a relative URL. It should 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 broken, browsers tend to ignore all but the first of them.)

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

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

This is not allowed due to the space character before the <base> . In HTML parsing, a space without a break, which is not a space character, implicitly closes the <head> element and opens the <body> element. This means that the <base> now in the <body> . Some browsers can still accept it, but the document mentioned in Tieson Ts says: "Internet Explorer 7 [and newer] strictly uses the base tag in the head > of the document, and will ignore non-local tags."

To validate everything, use a validator - it will, among other things, report problems like this.

+14
source share
+1
source share

All Articles