Web 2.0 — opening up a whole new world of Internet Explorer quirks!

Just when I needed it least, Internet Explorer has thrown me another curveball.

I’m hard at work trying to seem like less of a 20th Century web dinosaur by acquiring new skills with these techniques that are loosely lumped together into what some call “Web 2.0.” Key among these is an approach called AJAX (Asynchronous JavaScript and XML). Fun stuff. I’ve been working for the past several days on an interactive registration form for a site at work, using AJAX. Of course, as usual, I’m plugging away in Safari and Firefox, but eventually I decided to check out how things are looking in Internet Explorer.

[When I figure out an emoticon that represents my head exploding, I’ll insert it here.]

IE is consistently barfing on what it claims is a syntax error that I eventually tracked down to the evalScripts function in prototype.js. Well, at least it’s not my own code that’s making it crap out this time. Or is it? With IE you never can tell. Maybe evalScripts is buggy (even though I can find no evidence to that effect) or maybe it’s just the code in my script that’s being thrown at it. Whatever the case, once again all forward progress has come to a grinding halt while I scour the Internet fruitlessly for a solution.

Although this turned out not to be a solution to my problem, I just have to refer you to this developer’s blog entry on a typical IE workaround. Yes, I tried this, even though I was almost positive his problem was completely unrelated to my own (which was the case). Nevertheless, when a problem does arise in IE, the most likely eventual result of one or more days’ worth of sleuthing is the resigned acceptance of such hokey code bloat, rather than anything even remotely satisfying (or even logical).

There you have it. As for my own problem using prototype.js with IE, I did find a solution. Yes, it was my code, and it was something I had seen previously that was pretty much staring me in the face, if I had just bothered to heed Thomas Fuchs’s sage advice.

It all comes down to standard practice for wrapping <script> tags in HTML. I still have the habit of doing it this way:

<!–
//–>

The funny thing about that is that I know it’s completely pointless these days. It’s done so that browsers that don’t support JavaScript don’t inadvertently display the JavaScript code in the web page. But every browser has supported JavaScript since about 1997, so it’s pretty ridiculous to keep doing that. Especially given that, the way the sites I’m working on are so utterly dependent upon JavaScript, you’d never even get to the page in question without it.

However, with XMLHttpRequest (which is at the heart of AJAX), and just the increasing complexity of JavaScript in general, it’s become necessary to wrap script code in a new tag to ensure that browsers handle the code properly. To wit:

// <![CDATA[
// ]]>

Just as Thomas Fuchs said. And just as has been lingering in the back of my mind for the past several weeks, since I first discovered his wonderful tool based on prototype.js, Scriptaculous. I’ve learned my lesson.

‐.‐‐‐.‐‐‐‐..

Wow. For all my many years of waxing and waning Rush fandom, including having played several of their songs on the bass myself in a band a few years back, I never knew this about one of their oddest songs, the instrumental track “YYZ.”

Yes, of course I know YYZ is the code for the Toronto airport. But what I never realized, even as I was playing that rhythm, is that the opening of the song spells “YYZ” in Morse Code!

(I must admit I have some misgivings about saying I never realized it. I vaguely recall that as my bandmates and I were working the song out — from memory, not a recording — I was convinced that the last part of long beats was 5 and not 4, but the other guys might have used the Morse Code argument to prove me wrong. In fact, even tonight as I read about this and played the song in my head, I was still thinking it was 5, and, in my usual cocksure way, thinking “these websites have it wrong!” or “the band messed up the ‘Z’!” But then I actually listened to the song and realized it’s 4. Then I assumed the band I was in must have played it wrong, since I was so sure it was 5. So I listened to our recording of it and sure enough it was 4 there too! I guess the only thing that proves is that once again, it’s a bad idea for me to stay up too late on a Saturday night surfing the web.)

Here’s some more on the matter…

While I’m on the subject of Rush, I quickly googled (yes, it’s officially lowercase now, much to Google‘s chagrin) and was surprised to discover that, apparently, my high school friends and I are the only ones in the entire wired world who ever thought the band’s self-titled debut album cover looks more like it says RLISH than RUSH.