Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q530 My variable 'dir' doesn't work in Internet Explorer 4, aren't browser vendors supposed to follow some sort of standard?

You are here: irt.org | FAQ | JavaScript | Misc | Q530 [ previous next ]

Well, if I use a variable name like say 'dir', for example:

var dir = 0;

and it works in Netscape Navigator 2, Netscape Navigator 3, Netscape Navigator 4 and Internet Explorer 3 safely then you'd think that when Microsoft introduce another version of Internet Explorer, e.g. Internet Explorer 4, that it would still work.

But Microsoft (and Netscape) can and will introduce new window object properties, e.g. 'window.dir', but because each object property is an object or property of the current window, this can be abbreviated to 'dir'. Hence the problem. Any future version of any browser could introduce a new window property that conflicts with a variable used by a programmer in an, upto now, fully working script.

I would recommend that people use variables names like 'myDir', or maybe 'irtDir', there is then a lot less chance of any vendor introducing a property that clashes.

©2018 Martin Webb