Dealing with Internet Explorer in your JavaScript Code

It’s almost the end of 2008, and thanks to the hard work of web standardistas, browser vendors, and JavaScript framework developers, cross-browser JavaScript code is much less of an issue than it used to be. Even Microsoft is feeling the love — the upcoming Internet Explorer 8 will be a (mostly) clean break from legacy Internet Explorer releases and will behave much more like Firefox, Safari (WebKit) and Opera. …And they rejoiced.

So why is it that when I look under the hood of some recently produced web pages (learning management systems, courses produced by e-learning rapid development tools, general web pages, etc.), the pages’ JavaScript often includes incredibly out-of-date and bad-practice Internet Explorer detection?

Here’s a quick rundown on the dos and don’ts.

Extending the SCORM wrapper and ActionScript classes

I’ve had a number of people ask me why I haven’t extended my SCORM helpers (the JavaScript-based SCORM API wrapper and the two ActionScript classes) to completely remove the need to know any of the “cmi” calls. I have three reasons: SCORM is not that simple, the functionality between SCORM versions is significantly different, and extending the helpers that far means writing a complete (non-standardized) replacement syntax for SCORM.

cmi.core.exit & cmi.exit

Ok, I just had to write a quick blurb about this one: in about 3.5 years of using SCORM in my own course code, I had never used cmi.core.exit (SCORM 1.2) or cmi.exit (SCORM 2004). Seems incredibly daft of me now that I’ve taken a few minutes to review the documentation.