internet explorer

Tracking down error 80020101 in Internet Exploder

So yesterday, after all of the travel fun and games of the few days, it was back to the real world with a bump. I had a pile of bugs to fix on various projects. Most were very simple to get through, but one has taken me several hours to track down so I thought it would be useful to record the problem and my solution.

In IdeaJam we use Mootools as I have mentioned many a time before. Mootools, when executing Ajax requests does some very funky stuff to make the request as efficient as possible. One of those things, is that will detect the content type of the page you’re requesting and try it’s best to process it as it should, that is, if you request Javascript then it will try and execute it. Unfortunately if you’re in IE, then it uses the following technique 

window.execScript(code)

This is all well and good until there is an error in the Javascript it is evaluating (and it is very picky about syntax here). When there is an error you will get something like:

Could not complete the operation due to error 80020101

There are a *lot* of websites out there where people have come across this problem and then tracked it down to a specific problem with their code so they assume that this error message means you should remove comment tags from your script, or there’s a missing semi colon on the end of a line, or an array is incorrectly formed. All of these may well be true, but the error message just means “There is an error”, you can read no more into it than that.

Instead, you need to look very closely at whatever is being returned and evaluate it manually yourself to track down the issue.

What was especially galling for me, is that my problem was entirely my own fault. I had set the content type of the page I was requesting using Ajax to be text/javascript when it actually it should have been text/html. So Mootools was trying to evaluate some “code” which could never possibly work. So my fix was simply to change the content type of my response page.

The point is that your problem may be something entirely different, and you’d still get exactly the same error message from IE. Thanks for that Microsoft.

Cross browser testing using VMWare

As an Apple user, when I’m doing Domino development I live in VMWare Fusion to emulate Windows. And since the release of the Windows 7 Release Candidate (free until next year) doing testing in IE6 and IE7 is nigh on impossible. There are tools that you can use to emulate the different browsers (such as IETester) but I have found them to be unreliable.

It’s a little know fact that Microsoft actually give out free copies of Virtual PCs setup for IE6 and IE7 compliance testing from their website. Of course because it’s a virtual PC image and not a VMWare image we have to go a little further and convert the one to the other. That’s where these instructions come in. You’ll need to download a conversion tool, the one that worked for me was Q which is actually mentioned in the comments rather than the main body.

Once you’ve done the conversion, you end up with small (i.e. <1gb) Virtual Machines that you can do “proper” IE testing in until you get the nerve to tell you’re idiot IE users that they need to move into the 21st century and start using one of the proper browsers.

Anyway, what it does mean is that you can leave XP and IE6 behind altogether except for your testing which can only be a good thing. Windows 7 really is a big step forwards, even for those of us who don’t even like Windows.