To figure out:
- Does this work in all browsers we support? I have anecdotally confirmed support in Firefox 25 and Chrome 30
- Protocol-relative URLs in <base> are broken, because documents created this way don't have a creator context or whatever.
Benefits:
- Not a hack involving iframes :)
- Faster than the iframe hack
- Does not have issues with HTTPSEverywhere in Firefox
For the <base> issue, it looks like something like this will work:
d.querySelector('base')
<base href="//example.com">
d.baseURI
null
d.querySelector('base').getAttribute('href')
"//example.com"
d.querySelector('base').setAttribute('href', 'http://example.com');
undefined
d.baseURI
Version: unspecified
Severity: enhancement