- Internet Explorer 4 used
- Netscape4 used
From the version of IE5.01,
document.getElementsByTagName was supported, the only one that did not work in IE was
document.getElementsByTagName("*"); , which only started to be supported in IE6, so we had to use
window , this since the DOM was loaded and the variable had not been declared.
IE has maintained this feature to maintain compatibility with sites that had been made for previous versions, some browsers have imported this feature to try to maintain compatibility
My opinion: at the time it was very common to accuse the browser for not working on a particular site, when the problem was in the script, then many engine developers were forced to put those peculiarities in the engines themselves.
In Firefox for example
document.layers was still supported, but issued a warning on the console warning it would be removed, otherwise InternetExplorer kept many things like
document.all (this sometimes generates a DOM list other than
There was an engine called iCab (up to version 3 of the browser of the same name for Mac, version 4 onwards started using Webkit and Cocoa API) that had similar functionality to IE4 as
document.all , this was a way to maintain compatibility with sites made for IE.
It's likely (there's nothing discussed, it's just a guess) than with the evolution of browsers and "standards" of ECMAScript
window generate a variable that represents an element by id automatically is removed one day and only what is really needed is maintained, that is if you use something like
window.meuElemento , this may fail in the future.
I also do not recommend using the ID reference because of conflicts with variables that may have been defined and have the same name as
id (this is a problem that may already occur and does not depend on the future). >
Note that there are other properties to get DOM elements like:
Gets forms by index as
<embed> by index as
<iframe> by index as
window.frames , note that
window.frames does not return the DOM element of (i) frame and yes the object
window from inside it, this
window.frames then would be the same as doing this