pita msie and xhtml

2007-09-07 @ 02:14#

[sigh]

been fumbling w/ cleaning up my XHTML support for the exyus framework and am finding MSIE a constant source of aggravation. for a while, my pages were reporting errors due to MSIE rudely refusing to render pages that had mixed/suspect encoding (UTF-8/16). i sorted that out by making sure my runtime always uses UTF-8 for string dealings.

by far, the most annoying was the fact that i had to remove the xmlns="http://www.w3.org/1999/xhtml" attribute on the HTML element in order to get pages to render in MSIE. if i left it in, the page rendered as *blank* in MSIE. i was stumped. but i also noticed that i got the same results when i use method="xml". i learned to live with it, but finally got pissed again when it came up in my amaya testing. now amaya was complaining that my docs were missing the xmlns tag *and* producing invalid XHTML (thanks to method="html"). !dangit!

i spent some time digging (and googling) and finally found the answer. pure XHTML output from XSLT was closing my script tags (<script type="text/javascript" src="support.js" />). when that happens, MSIE just renders the document *blank* (sheesh!).

the solution? get some kind of content between the start and end script tags. this will force XSLT to retain both the opening and closing script tags in the final output.

<script type="text/javascript" src="support.js">
// hack to avoid MSIE bug
</script>

code