A little corner of the Empire on the web.

01 November, 2005

So, Javascript is a workable programming language!

I've used a fair bit of JavaScript code in the past to add client-side flourishes to web-pages and build simple, calculator-style apps, but I've never really done anything very complex with it before.

I think that probably the last time that I tried writing any serious kind of an app using JavaScript was back in the Netscape 3/IE 3 days, and it was very, very painful. Since my apparently futile attempts to work around myriad browser bugs, implementation differences, browser differences, DOM differences (not that I even really knew what a DOM was then, did people call them that then?) and so on, I've stuck to simple work with form boxes, style changes and simple things like that.

Then came the MSN Messenger World's Best App competition, and I'm suddenly in the middle of building a really fairly complicated platform for building simple multi-player internet games, and I'm doing it all in JavaScript. Well, I might eventually build in a bit of server-side persistance with Perl, but that's going to be completely independent of the client-side bits and only really for providing the icing on the cake (I'm even thinking of implementing save-game client-side rather than saving on the server).

So obviously one of my first unconscious choices was, just how hard can I make this for myself? Well to answer that I took a look at my favourite web testing platform: Gecko/Mozilla and realised I couldn't do without all the amazing development, testing and debugging tools it gives you, and decided that I was going to make the core of the program totally cross-browser (obviously this can only go so far with an app that is going to eventually use the MSN Messenger API for cross-internet comms, but I'll be going right up to that line). So we have hurdle one, it must work in both IE5 & 6 (as per competition rules), and Mozilla (to allow me to use my favourite tools) and also Opera (as I didn't feel like leaving it out)!

Next choice, if I'm going to make it run on all three web browsers it had better use standards as far as humanly possible (so that theoretically compatibility should just work, no giggling at the back there!), and if I'm going to code it to W3C/ECMA standards, then there's no point in going half-measures, so no browser specific coding allowed. If it's being coded to standards, without any browser-specific code, then why not pick a decent standard? So XHTML 1.1 loose it is (and by that I mean also testing with an XML MIME type to trigger the totally intolerant strict XML processing mode in Mozilla browsers).

Quick summary of choices made simply to make my life harder, but also more challenging and interesting:

  1. All parts not dependant on the MSN Activity API must work in:
    • IE 5 & 6
    • Mozilla/Firefox
    • Opera
  2. Stick to standards, no browser specific hacks or code paths
  3. XHTML 1.1 loose doctype
  4. Must also work when served to Mozilla with an XML MIME type.

So, I'm not getting much sleep lately!