We've all seen pages with JavaScript like this, which uses vendor-
specific implementation quirks to decide between two heaps of
vendor-specific code:
var NS4 = (document.layers);
var IE4 = (document.all);
[btw, it should really say !!document.layers and !!document.all
so the results will be Boolean]
So, which of the two browser-detect vars will be true if I'm running
K-meleon? Would a standards-compliant browser have layers in
its JS document object model? Would it have 'all' ?
And then the really fun part, if it *had* 'layers' it still probably
wouldn't have all the *other* Netscape elements that the hapless
JS coder is counting on using, once he's found layers do exist ...
{ I just tried a test page and *both* detect vars came up undefined,
or false if the !! operator is used as I suggested. YMMV, but this
probably explains why the JS-heavy site I just visited w/KM refused to
show me most of its content. }
Of course, if Web developers weren't so obsessed with being cutting-edge,
their sites might behave reasonably with EVERY browser :-|
eh... if folks want their site content to be widely accessible, they generally (but not always) know how to make it so. if the site exists purely for the purpose of making a vulgar display of gratuitous (and sometimes dubious) scripting, you have to assume that the creators don't consider the content itself (if any) to be very important...
all just depends on what your trying to accomplish, i reckon.
neither document.layers nor document.all is DOM compliant, they are both proprietary extensions. I don't remember any standards that k-meleon supports and netscape 4 doesn't off the top of my head and atm I'm too lazy to look them up. I'm sure you can find some pretty easily on google.
Yeah, it's an effort for web developers to make things compliant just with netscape and IE... I had to give up my lovely planned iframes because netscape 4.7 doesn't support them...
But now I'm working with php and mysql. Muahahahahhh!