All your are belong to us
For IE 7 we decided to make some changes to the way the <BASE> tag is handled to bring it up to spec and at the same time fix some really odd behavior. In the process we expect some people relying on the previous behavior to have to update their content otherwise they may find their site doesn't work exactly as planned. Most of the old functionality is still there, but there are some key differences.
To start, in previous versions of IE, you could place the BASE tag anywhere in the document. This behavior isn't per the specification even as far back as HTML 3.2 which specifies there should only be one BASE tag per document and that the BASE tag should appear in the HEAD element. Because we allowed the BASE tag to appear anywhere it allowed you to BASE different portions of your document to different locations. Now with IE 7 we'll be ignoring any BASE tags that appear inside of the BODY tag and we'll only obey the first BASE tag that appears in the HEAD element. For pages that used the old behavior they may now have broken image links or anchors that don't navigate to the proper locations. The workaround is to move the BASE tag into the HEAD tag and only have one BASE per document per the HTML 3.2 and later specifications.
The BASE element in older versions of IE was also a container element. In order to support multiple BASE elements per page and have them affect any elements following them in the tree they become descendants of the BASE element. When we need to look up and create an URL for either a link, anchor or area element we simply walk the parent chain until we find the first BASE element. This was a great shortcut, but it does have some problems. First the BASE element is now considered in CSS matching rules. So if you have any BASE elements in your document then at some point you may have to include them in your selectors for them to properly match. This would mean making special IE only rules which aren't compliant and wouldn't match in other browsers. Another side effect is that the BASE element when defined in the HEAD element would end up being the container for the BODY tag. This would break common rules using the child selector (>) from CSS 2.1 since HTML > BODY would simply fail to match because the document tree would contain a BASE tag between the HTML and the BODY tags. In IE 7 the BASE element no longer contains any other elements so you don't have to worry about including it in CSS rules and it won't show up as an element in the document tree between the HTML and BODY.
What this means for IE 7 is that we are more compliant to the HTML specifications. It also means being more compliant in the areas of CSS and selectors. And finally it means you can more reliably walk the DOM to get the information you need without having to worry about looking under BASE tags for nested child elements. In previous versions of IE the placement of the BASE tag might mean that a quick scan of all of the direct children of the HEAD element would come up a few elements short if those elements followed the BASE tag.
Supporting the new IE 7 behavior should be really simple as long as you weren't previously relying on the use of multiple BASE tags. Basically, you'll want to make sure any BASE tags you have appear within the HEAD element and not inside of the BODY or as part of a bare document that doesn't contain a HEAD element. Try to include only one such tag since behavior within IE when searching for the BASE tag is only going to look for one of them. If you have more than one, then you might not get the desired behavior. If you previously wrote any CSS selectors or DOM walking code that accounted for the BASE tag you'll find you don't need to do that anymore and you can remove those extra rules and code (or just leave them in, they won't match)!
- Justin Rogers
Resources:
HTML 3.2 Specification for the HEAD element and its children
Sample HTML files with DOM trees for both Pre IE 7 and the new IE 7 behavior
Comments
Anonymous
January 01, 2003
At least we're getting closer towards full compliance. Albeit slowly but surely, but better late than never?Anonymous
January 01, 2003
Well, I guess compliance starts somewhere.
But surely compliance with modern specifications, such as XHTML1.1 should come before older specifications, like HTML3.2
Unless, of course, the things that aren't implemented properly in HTML3.2 are blocking XHTML1.1 compliance. But refresh my memory, is the <base /> element even in XHTML1.1?Anonymous
January 01, 2003
Most ironic title for a blog entry ever.
Glad to see something's being done anyway.Anonymous
January 01, 2003
YAY! this is good happy fun time!
this is exactly how IE 7 should be handled. Even if it does break existing sites, it makes IE behave exactly how it should. To better prepare for the future, you must sometimes sacrifice the past, Buffy.Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
You have no chance to survive,
make your time
HA HA HA!
(Couldn't resist)
In all seriousness, I can imagine phishing attempts on site messageboards would be possible by overriding the base tag within the document itself.
Good work.Anonymous
January 01, 2003
Hooray for compliance fixes :) Thanks guys.Anonymous
January 01, 2003
Thanks Justin for an informative, detailed post. Let's hope there are more posts forthcoming of a similar nature regarding changes to IE's HTML handling.Anonymous
January 01, 2003
"This would break common rules using the child selector (>) from CSS 2.1"
Whoa... does this mean IE 7 will support the CSS 2.1 child selector??
SWEET!!Anonymous
January 01, 2003
Nice to see Microsoft IE developers turning to standards. Compliant websites are starting to recommend browsers other than IE because of their lacking in that area. At least now they might put a message saying: "Best viewed with Firefox or IE 7" instead of "Best viewed with anything but IE"
Microsoft is always hit very hard for having a bad rep for insecurity and manipulating things to go their way only. Maybe Windows Vista and IE 7 can change this, but it's hard for me to get "excited" about the future. Articles like this at least make me feel like things might change, but it's more of a "see before I believe thing".
Keep up the good work :-)Anonymous
January 01, 2003
GOOD WORK
---------
Xcellent.
Logical.
Reasoned.
Compatible.
--and this is Microsoft! Alright!!Anonymous
January 01, 2003
Funny. IE 6 or below doesn't support child selector, right?Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
The IEBlog has just posted an&nbsp;entry about the behaviour of the BASE tag in IE7. The standard (back...Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
I was waiting for IE with tabs 4 like 6 months and its really great!!!
Everything is well and good but why have you dis-arranged the menu-bar, tab-bar, address-bar like that?
And the worst part is it cannot be changed!
the usual way wud naturally b that menu bar stays on top.
Other features of IE7 r cool! GREAT WORK!!!Anonymous
January 01, 2003
It's not a big step, but it is the correct attitude!!! Every IE feature that deviates from the spec is just another compatibility nightmare for web developers.
Little things like this (so long as there are lots of little things like this fixed) will please me greatly when it comes to making web apps and web sites.Anonymous
January 01, 2003
Did you also fix the bug with same-document references (f.e. "#somewhere") together with a base element?
See f.e. Google cache results:
http://66.102.9.104/search?q=cache:xuTmYd9HCSMJ:www.w3.org/TR/REC-html40/struct/links.html&hl=en
The links in the toc should stay in the current document (the cached document), they should not jump to the original document.
See RFC 3986, section 4.4.
http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#same-documentAnonymous
January 01, 2003
Thanks a lot Justin, this kind of precise, feature by feature, fix by fix, implementation by implementation blog posts was exactly what I was looking forward to seeing on this blog.
Thanks.
A lot.
Please, don't hesitate to do that more often
> Whoa... does this mean IE 7 will support the CSS 2.1 child selector??
> SWEET!!
Yes, it's been stated in the IE7b2 feature list that IE7 would implement full CSS2.1 selectors support.Anonymous
January 01, 2003
Why the odd changes to the IE user interface and toolbars? I really like having forward/back/stop/refresh as regular buttons in the "Standard Buttons" toolbar. I also place my address bar next to the menu right after "Help" which has been a nice placement and saved vertical space.
Now there's the forced combination back/forward/address bar pinned to the top of the window ABOVE the menu. Very disappointing. Keep at least the level of configuration that IE 6.0 has. Or at least let me turn it off via the options. I think it's ok to have the stop/refresh combined, but the rest is not good.
Awful, awful, awful.
Also, please fix CSS. There's really no excuse for the lingering defects.Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
It’s nice to read this, shows that Microsoft even pays attention to less-used features such as <base> :). Although you were probably forced to fix this because you were implementing the child selector, I think it shows promise for the kind of bugs / non-standard behaviours that you are fixing in IE, and that you are not afraid to break things when doing so. I’m eagerly awaiting Beta 2!
"Funny. IE 6 or below doesn't support child selector, right?"
No, and that is exactly why the old behaviour wasn’t a problem up till now :).
~GrauwAnonymous
January 01, 2003
Xepol, you really are a one tune kind of guy, aren't you? yawn
Do you think Microsoft is suddenly going to offer IE7 on 98 just because you whine about it in every post here?
The beta 1 is out. There will be a beta 2 at some point. They aren't going to go develop IE7 for unsupported operating systems now. Heck, you can't even make 95, 98, or ME secure because they are DOS based.Anonymous
January 01, 2003
I think it is important to note that certain fixes, like that of the BASE element and the types of object model trees it was responsible for forming, aren't just in place to support certain features.
The previous behavior of the BASE element was actually in place for a specific reason. So that we could support multiple BASE elements on the page. Yes, this wasn't spec'ed behavior, but it was a behavior that was prominent on the web.
Primarily due to the object model tree not being properly formed because of this we decided to change the BASE element implementation. It just so happens that it also fixed some odd behaviors I was seeing while implementing CSS 2.1 child selectors.
Isn't that neat? You have way more insight into the world of IE now.Anonymous
January 01, 2003
Justin,
I echo previous comments that this is the sort of blog post web developers want to read. We know what changes have gone into beta1 and we know what is planned for beta2, but it is a completely different thing reading about planned features and reading about them being implemented.
As a web designer/developer I don't like IE and I haven't for some time now, but I am eager to see what the public beta will hold. Many web designers/developers, myself included, play several roles at one time (graphics, html, css, php/asp, sql). Working around IEs bugs, just wastes time, money and patience. All I want to do when I begin a new project is type in what I know should be there in the correct order, and boom, everything works as expected. If IE7 allows me to do that, I'm in.
Great positive post, keep them coming.
Sorry for the rant :-)
Cheers;
PonchoAnonymous
January 01, 2003
One more thing:
I hope Microsoft marketing will make a BIG thing of the IE7 release to push adoption rates up quickly. Specifically I'd like to see IE7 added to Windows Update as a mandatory update for WinXP. Amazingly there is still quite a large installed base of IE5 6.1% of all web users is a lot of people. I would hate to think that we have to support IE6 for more than a couple of years.
Thanks and good luck to all the IE team members. I understand it's a long road ahead.
Cheers;
PonchoAnonymous
January 01, 2003
@Allen
I agree with you. It was a big advantage of IE to have a completely customizable toolbar layout. I even leveraged this to build my own address bar which could easily replace the standard address bar while adding some features I always wished to have in IE. It would be bad if this flexibility will be lost in the final release of IE 7. At least there should be an option to separately turn off the address and tabs bar.
@IE team
Thanks for the insight and detail you give us on certain aspects of IE. I would be glad to read something about the changes made to the IE platform SDK in a future post.
And one question for your managers: Why is there no easy way to report bugs in MS software? That's ridiculous.Anonymous
January 01, 2003
Just out of interest I thought I'd see what MS's own site looks like these days, I couldn't believe it when I tried this!!
http://validator.w3.org/check?uri=http%3A//www.microsoft.com/
I am truly shocked!Anonymous
January 01, 2003
lol @ seb
Normal service seems to have resumed on all the pages linked to from www.microsoft.com though.
Just try some from the left-menu... Windows, Office, Win Server and Dev Tools, they all fail to validate - some spectacularly!Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
Hi,
Sorry about my behavior but i will try again :)
How many time all IE 7 users should wait until a "Pishing Site" appears as "reported" by IE 7 ? I mean, if an user report a site as "Malicious", when all others will see this site reported as "Malicious" by IE 7 ?Anonymous
January 01, 2003
> Can we please, please, PLEASE, get an option or mode or setting where IE will tell us everything that is wrong with a page, rather than trying to guess?
Seconded. Call it "Developer Mode" or something.Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
@ Seb
>>Just out of interest I thought I'd see what MS's own site looks like these days, I couldn't believe it when I tried this!!
http://validator.w3.org/check?uri=http%3A//www.microsoft.com/
I am truly shocked!<<<
Whats kinda funny is if you try apple.com
(3 or 4 errors the last time I did)
better yet try opera.com
(ditto)Anonymous
January 01, 2003
Hmm, www.opera.com passes as XHTML 1.0 Strict (an impressive feat!), but then they've been busy updating their web page over the last two days, so it may not have when you tried it. Of the 3 errors I see on Apple.com, one's a gracefully-degrading nonstandard feature, and the other two are easily fixed, but in JS code from another source. Still impressed with www.microsoft.com -- for a site legendary for browser sniffing and IE-only code to go 100% standards-based is a great move!Anonymous
January 01, 2003
@Ian Boyd (and Maurits)
"i WANT to know if there are problems on my web-page."
Then run it through a validator. http://validator.w3.org has been mentioned a couple of times in this very thread.
IE is a browser, not a validator.
@Justin
Great post title :-) I like the content too. More of the same please...Anonymous
January 01, 2003
Let's not all get too excited about microsoft.com validating. Clicking the big picture in the middle of the page labeled "Choice" takes you to http://www.microsoft.com/windowsxp/evaluation/compare.mspx , which miserably fails validatation: no DOCTYPE, proprietary elements and attributes everywhere, etc. I didn't test any more page, but obviously they have not built validation or any thought of standards compliance into their content management system; somebody just took a little time to clean up the home page. Yippie. Call me when the other million pages validate, and I'll be the first to trumpet their efforts.
As for [base], excellent news. I don't see any any indication that this is based on DOCTYPE sniffing. Does this change affect all pages, or only pages with a strict DOCTYPE?Anonymous
January 01, 2003
I'm aware of the validator, thank you. But I want to be able to validate local files too, and I don't want to wait for a server round-trip, I want the "preview" window to validate.
The validator is a simple DTD validator... it doesn't catch things like
'inputs of type="checkbox" require a value attribute'
because such things cannot be expressed in a DTD. On the other hand, browsers with validation-mode switching can throw a "expected value attribute" exception in the rendering phase.Anonymous
January 01, 2003
One of the purposes of releasing the IE7 beta is to collect feedback on compatibility with both websites...Anonymous
January 01, 2003
Maurits: I use a built-in HTML validator extension available for my preferred browser. I don't expect IE would offer similar functionality since this is primarily a consumer-oriented product -- a part of the operating system -- for the average user, not necessarily the power user. Developers always have the ability to find more specialized tools for our needs.
Back on topic...
"Primarily due to the object model tree not being properly formed because of this we decided to change the BASE element implementation. It just so happens that it also fixed some odd behaviors I was seeing while implementing CSS 2.1 child selectors."
I'm glad to see you guys are going through and cleaning up things like the DOM tree from the ground up.
As much as I'll enjoy things like child selectors (and still hope for min/max-width/height!), it's important that IE7's CSS 2.1 compliance won't just be slapping in new features and calling it a day.Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
As far as I've tried, base href in IE6 doesn't apply to CSS @import and JavaScript window.open (and showModalDialog). Is it going to be fixed? Although I don't know what the specs say about that, but it looks like a bug. Anyway, it's good to know that IE7 is moving towards standards compliance... keep it up.Anonymous
November 13, 2006
PingBack from http://mondaybynoon.com/2006/11/13/the-pros-and-cons-of-the-base-tag/Anonymous
December 26, 2006
PingBack from http://www.csskarma.com/blog/?p=12Anonymous
January 11, 2007
PingBack from http://www.ie7security.net/2007/01/11/important-changes-to-the-base-element-for-ie-7/Anonymous
March 24, 2007
PingBack from http://blog.hait.de/2007/03/25/internet-explorer-7-das-base-tag-und-ungunstige-umstande/Anonymous
May 10, 2007
PingBack from http://www.cjohansen.no/2007/05/10/storebrand-lanserer-nye-nettsider/Anonymous
October 25, 2007
PingBack from http://www.csskarma.com/blog/?p=22Anonymous
January 04, 2008
PingBack from http://i8jesus.com/?p=10Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-2/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-4/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-5/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-6/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-7/Anonymous
January 09, 2008
PingBack from http://correctserver.com/htmlcss-injections-primitive-malicious-code-or-what%e2%80%99s-the-worst-that-could-happen-8/Anonymous
April 28, 2008
PingBack from http://blog.dotsmart.net/2008/04/21/ie-6-bug-causes-jquery-globaleval-error/Anonymous
May 26, 2008
PingBack from http://kamari.freereportcontent.info/allyourbase.htmlAnonymous
June 26, 2008
PingBack from http://taliyah.adultpornostories.com/allyourbasearebelongtous.htmlAnonymous
May 29, 2009
PingBack from http://paidsurveyshub.info/story.php?title=ieblog-all-your-lt-base-gt-are-belong-to-usAnonymous
May 31, 2009
PingBack from http://woodtvstand.info/story.php?id=14873Anonymous
June 08, 2009
PingBack from http://toenailfungusite.info/story.php?id=5533Anonymous
June 09, 2009
PingBack from http://insomniacuresite.info/story.php?id=8865Anonymous
June 14, 2009
PingBack from http://adirondackchairshub.info/story.php?id=126