This is definitely a very annoying bug in IE, but I just found a workaround.
The thing to realize is that IE does resolve the relative path, and then promptly ignores it. You can even see the fully resolved URL by checking the value of the base tag's 'href' property later on using JavaScript. So this (rather silly) piece of code resets the <base>
tag's 'href' attribute to the very full URL that IE had already resolved, thereby causing it to no longer be ignored.
Add the following HTML to the top of your page, right after the tag and before you actually use any URLs:
<!--[if IE]><script type="text/javascript">
// Fix for IE ignoring relative base tags.
(function() {
var baseTag = document.getElementsByTagName('base')[0];
baseTag.href = baseTag.href;
})();
</script><![endif]-->
(conditional comments necessary since this code can break the <base>
tag in Safari/Chrome, and other browsers clearly don't need it.)
Such a silly bug.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…