Internet Explorer’s Javscript – what they don’t teach you at the W3C…

There seems to be a few IE7 JavaScript caveats which are outside the usual non-standards rubbish. I’ll use this post to list them as I find them (so I will be updating it occasionally). If that’s the dominant browser gods help us all. One would have thought that if a company goes and releases a dominant browser which is flawed in so many ways, that they would also release a decent set of debugging tools to go with it… But no… no such luck. So:

  • Don’t use JavaScript keywords like ‘return’ as an associative array’s (or object’s) keys. If you do, don’t refer to them in dot notation. Use the associative array way of obj['key']. IE will not like it. Not one bit.
  • When you return JSON formatted data, remember to use strings as keys. While Firefox will accept JSON with non stringed keys (i.e., {key:’value’}, IE requires them to be properly stringed, i.e., {‘key’:'value’}
  • Don’t add an extra comma after the last object property:
    object = { prop:val, prop2:val, prop3:val , };
    That last comma after prop3:val will make IE sad.
  • Install that dreadful Microsoft Script Debugger… It’s not very good. Strike that – its pretty bad and will make general web surfing a nightmare but its the best you’re going to get.

One Response to “Internet Explorer’s Javscript – what they don’t teach you at the W3C…”

Leave a Reply