Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Misc | Q530 [ previous next ]

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

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.


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.