Why I think Internet Explorer is the best browser for JavaScript development…

I've started learning JavaScript in November 2009, so about 2 months ago. I am a WebForms developer in my Job, thanks to SharePoint, and I was fed up one day with static/postback-only user interfaces. I wanted to make them snappy, cool, Web 2.0™.

One of the things that kept me away from JavaScript in the past was the browser support hell. Every browser has little differences in it's implementation, and even trivial operation often require an if-statement with 3+ branches to get the differences straightened out. Luckily, libraries like jQuery are available to abstract the whole mess away and give us a clean interface to interact with the browser. I am a big fan of abstractions as long as I know what I'm abstracting away, and jQuery is pure gold that allows me to focus on the actual application/user interface I'm building. After lerning about JavaScripts scoping rules (variables are available to the entire function - { and } do not create a new scope) I was finally able to understand, troubleshoot, and (hopefully) fix a bug in a third party library that I'm using - finally being in control feels great!

But, I have one issue, which is the JavaScript support in Chrome and Firefox. This is a controversial statement for sure, as pretty much everyone agrees that Firefox and Firebug is the de-facto standard for JavaScript development, which I would normally agree with - as good as the Web Developer Toolbar became in Internet Explorer 8, Firebug is still the nicer tool. But my problem with Firefox and Chrome is that they are too lenient about bad JavaScript.

I'm guessing that this is because most JavaScript on the web is simply broken, and throwing an error every time an error is occurs would seriously degrade browsing experience. So I'm guessing that just as with broken HTML, "modern" browsers try to fuzz and fix the JavaScript. One of the reasons XHTML failed was because it was too strict, and because browsers didn't complain loud enough.

I had 3 hard to track down JavaScript errors. Well, hard to track down for me. In all three cases, the error was mine. An extra comma before a closing bracket, forgetting to close a bracket etc. Firefox worked flawlessly. Chrome had a subtle bug. The only browser that constantly does the right thing is Internet Explorer 8: It refuses to execute the JavaScript and throws an error instead.

Internet Explorer showing an Error

When developing, this is what I want. I want any errors to be reported. I want the application to crash hard. I want the browser equivalent of -Wall and -Werror. Granted, the Internet Explorer error messages are not that helpful as they only roughly outline what the problem is, but still they are useful enough to work with.

As a developer, I still care about my code. I try to write valid HTML, valid CSS and valid JavaScript whenever possible and at least know when I'm breaking the rules in the cases where valid code is not feasible. So any functionality that sweetens the experience for the end user by hiding errors is making the experience for the developer worse. I know that there are many advocates of loose standards and "just somehow automatically fix it", but ultimately I think that standards exist for a reason and I'd like to at least know that I'm doing something wrong.

But then again, this is the Internet and I realize that design and content are much, much more important than code quality, and I agree that providing value to the customer is ultimately more important than having a solid code base. But still, please leave me my illusion that good code and web application are not mutually exclusive 🙂

Comments (4)

[...] Dieser Eintrag wurde auf Twitter von Michael Stum, Dorian Muthig erwähnt. Dorian Muthig sagte: I totally agree! 🙂 http://tinyurl.com/yzlldgv [...]

MartinFebruary 22nd, 2010 at 04:46

You couldn't PAY ME enough money to develop / debug in JavaScript... I'd happily take 50k/yr to develop in Firefox or Chrome vs. 450k/yr to develop in IE.

Just look at the number of IE bugs you'd have to deal with first hand (even if you knew they existed!)

http://webbugtrack.blogspot.com/search/label/IE

IE has a 10:1 bug ratio versus ALL other browsers combined!

Like they say, If you'd been developing for most of the last decade you would have already given up on IE... if you haven't... you haven't been doing it long enough!

MartinFebruary 22nd, 2010 at 04:48

Doh, that was meant to be:

"You couldn't PAY ME enough money to develop / debug in JavaScript in IE."

though you likely got that from the whole message. 😉

mstumFebruary 22nd, 2010 at 07:41

As said, for me it's the exact opposite. So far, each and every thing that didn't work in IE was a genuine bug in my Code, and often Chrome and Firefox just silently swallow/auto-correct the error. Maybe I just haven't ran into any issues - the style issue for example would be a non-issue as I'd prefer server-side combining and compressing, but who knows, maybe I'll run into these issues at some time. But so far, I'd rather work with a browser that reliably errors out than with browsers that decide to do their own stuff without telling me.