html - IE doesn't support relative paths in the base element when referencing CSS files -
i have site uses base tag set absolute path relative urls. works fine in browsers tested in, except ie (big surprise). based on request ie making css file, seems not notice base tag. acknowledge base tag else on page. why happening? can done it, besides using absolute path reference css file? here code:
<!doctype html> <html><head> <title>base test</title> <base href="/basetest/"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div>foo</div> </body></html>
this in basetest/style.css file:
div { background: yellow; }
edit: same thing seems happen images too. of tests did in ie9. problem came in standards mode, ie8 , ie7 compatibility modes.
edit 2: works fine if specify absolute url. didn't know support relative urls recent feature. may abandon plan use base tag avoid repeating paths, unless can find way (like maybe js hack) make work.
sample page: http://www.debugtheweb.com/test/base/relative.html
i don't know sure if issue in ie or not, according relevant portion of the html 4.01 standards document, url in base href must absolute uri. further, in example, given looks (with filename on it):
<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <title>our products</title> <base href="http://www.aviary.com/products/intro.html"> </head> <body> <p>have seen our <a href="../cages/birds.gif">bird cages</a>? </body> </html>
in google searches, found discussion of version firefox added support relative paths in base href (which using) not has been there , not 4.01 standard appears describe.
the html5 spec seems describe , allow base urls not have host portion (host relative) perhaps has been added specs ie has not supported yet or has not supported yet css file loading.
i suggest try putting domain in base href.
Comments
Post a Comment