HTML

AJAX problems in IE

Oliver Brown
— This upcoming video may not be available to view yet.

One of the things I’m working on right now (at work interestingly enough) uses a fairly simple JavaScript function that takes a url and an element id and replaces the content of that element with whatever the url returns.

This worked well until I started getting an odd error from IE - Unknown runtime error. Firefox and Opera both handled this fine. After some fiddling I discovered the problem was the type of element I was replacing into - Internet Explorer doesn’t like you replacing the innerHTML of certain elements.

So far I’ve found TR and TBODY don’t work (and I’d guess THEAD and TFOOT too).

Looking good in every browser

Oliver Brown
— This upcoming video may not be available to view yet.

Okay, “every” is overstating it. The site has always looked how it should in Firefox (and Mozilla variants) and Opera as well as almost right in Internet Explorer. And although I didn’t look in depth it seemed fine on Safari when I used a friend’s Mac.

Well now it looks how it should in IE too. Although I did have to do a pretty nasty hack of sorts (but I remain XHTML compliant).

IE supports “conditional comments”. They’re HTML comments in a specific format which IE interprets as special. Overall this is quite a clever idea since the other browsers see them as normal tags and technically my site isn’t using any no standard markup.

The dodginess in IE (if you hadn’t noticed or don’t use IE) is that the graphic behind the Google links bar was 1px to the left. So all I did was put a style definition inside an IE conditional comment to nudge it to the right: <!--[if IE]><style> #linksbar { background-position: 1px 0 } </style><![endif]-->

Apparently you can do cleverer things with the comments like so conditionals on specific version of IE but that’s getting a little silly and if you want that much control it’s probably better to do it on the server so you don’t send every version of a page to every browser…

For more information, check out conditional comments on Quirks Mode.

Google and bad markup

Oliver Brown
— This upcoming video may not be available to view yet.

I had quick look at the source HTML on Google Analytics (specifically the first page: executive summary) and saw a piece of really bad markup: They had the whole page (HTML, HEAD, BODY, the lot) wrapped in a DIV tag… Naughty Google.

iMode and cHTML

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve seen adverts around for iMode recently, with no idea what it was. Well I found out last night by coincidence after looking around Google Sitemaps. Well sort of. Although I didn’t look at the details it seems like some sort of alternative to WAP. What interested me more was cHTML, iMode’s equivalent of WML.

cHTML, or Compact HTML, is basically what WML should have been. Instead of completely new tags and new way of looking at things it’s just a subset of HTML that makes sense for mobile devices. There are a few extensions to normal HTML but these aren’t required and are very simple anyway (like using tel: in a link the same way you’d use mailto:).

Of course I don’t really have any sites that would make sense in a mobile world…

Just search for imode chtml for loads of bits of info.