Subscribe:   RSS icon   twitter icon

Sorry, IE Users

If you are still using Internet Explorer, I will not take this occasion to mock or scold you (but you really should switch to a modern browser). Instead, I would like to apologize for the odd and nearly blank pages that you have been offered on my website lately. It’s fixed now, and you can once again enjoy the bounty of my wit and wisdom.

One problem was the use of a touch of absolute positioning in my style sheet, which caused the clever quotation on my front page to appear underneath the name of the website. That was one of the well-known IE CSS positioning bugs.

The other problem was more obscure, and is not, probably, an IE bug at all. In fact, in this case the behavior of IE can be argued to be more consistent with the specs than that of the other browsers that I check the site on and that rendered the pages “correctly.” And my real reason for writing this note is to call attention to this problem, which is sure to bite others who use, as I do, an xml library to create xhtml webpages.

The problem, described elsewhere in some detail, arises when you have an empty script tag in an xhtml page, like this:

<script src=“http://blah-blah” type=“text/javascript” />

I don’t have much javascript on this site, but I do have some Google search boxes, which were implemented with empty script tags like that.

If you serve a page with these empty script tags as text/html, which you need to do for IE, the rest of the page following the tag will be blank.

Here is the amusing part. I didn’t write the search script tag that way, but properly closed, like this:

<script src=“http://blah-blah” type=“text/javascript”></script>

This works fine in IE, and this is the way you should do it. But I put this code in my python program that uses the elementtree library to create the final xhtml pages that are uploaded to the server and become my website. And elementtree minimizes empty tags such as the above into the form that is wrong when served as text/html. The only easy way I know to fix this is to add a gratuitous space inside the script tag. I did, and now everyone is happy.

Who, or what, is at fault here? As clarified in the comments here, IE can not be blamed (this time). And elementtree is creating a valid representation of the xml that I gave it; even though it changed my markup, it’s allowed to do that. I think this is a side-effect of the kludge of serving an xml document as html and hoping things will work. So the fault lies either with me, thinking that xhtml was a good idea, or with IE, not for parsing the html incorrectly, but for forcing me to serve it as html at all. I think I’ll blame Internet Explorer. So there.


Share with Facebook Share with Twitter Share with Reddit Share with StumbleUpon Share with Digg Share with Slashdot
▶ Comment
lee-phillips.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.
Quotilizer ... loading ...

Tenuously related:

The best tool for CVs with publication lists.