brettbrewer.com

Programming + Design

Home
Developers Beware: IE Toolbar CAUSES javascript errors in IE6 and IE7 PDF Print E-mail
Written by Brett Brewer   
Sunday, 01 February 2009

If you're a web developer that had the misfortune to replace your old IE developer toolbar with a newer version, you may have seen some brand new javascript errors appearing in your sites only in IE. You may see a Just-In-Time Debugging window that looks like this . If you debug the javascript error in MS Script Editor it will break at a remote procedure call:

[540] C:\Program Files\Internet Explorer\iexplore.exe

...and if you continue debugging from there you'll get the following error message from Visual Studio:

Microsoft JScript runtime error: Object doesn't support this property or method.

Tracing the code reveals this incredibly sloppy function:

function ParseDoc(doc)
{
     var aRules = GatherRulesFromDoc(doc);
     collSelectors = parser.Parse(aRules);

     // Set quirks mode if necessary
     if("BackCompat" == doc.compatMode)
      {
          for(var i = 0; i < collSelectors.Count; i++)
           {
                 collSelectors.item(i).SetQuirksMode(true);            
            }
     }
}

The red line above is what causes the error in IE6&7. Seasoned javascript developers will notice the complete lack of error handling here. I'd expect this from something I'd written myself, but not from an offical Microsoft product targeted towards developers who are likely to have strong opinions on poorly written code. It blows my mind that this problem has been around for many months, has an easy fix and MSft just hasn't bothered to release a fix. A single try/catch statement wrapped around the offending code is all that is required...literally 1 line if elementary javascript. Of course, since MSFT products are not open-source, the people who know the solution are not allowed to release a patched binary of the toolbar, so to fix this problem, you'll need to get a resource editor and follow the instructions from this nice hacker at NanoAnt. Of course, disabling the toolbar entirely and doing all your development in Firefox is another popular option. 

Last Updated ( Monday, 02 February 2009 )
 
< Prev   Next >

Search

Who's Online


© 2017 www.brettbrewer.com
Joomla! is Free Software released under the GNU/GPL License.