Internet Explorer script tag failure for valid xhtml

Boy, what a day!

I was working on the weirdest bug with a colleague today where we were receiving a javascript “Object expected” error when we migrated a page into our new ASP .Net Master Page format.

We thought we hadn’t made any breaking changes, all we had done was move the <script> tags into the MasterPage file from the content page.

That didn’t work, so we created a header content place holder in the master page <head> element and in the content page put back the <script> includes. That didn’t work either.

We then included the <script> tags in both the master and content page. That seemed to work. Very odd.

In the end after many attempts to figure out what was going wrong, we found the problem was with how MSIE parses <script> tags, it cannot use self closing tags or an empty element – ie. <script … />.

It has to have the <script></script> tag.

For more info check out quirksmode.org.

Posted in .Net, Asp.Net, Javascript by Ben at January 11th, 2007.

One Response to “Internet Explorer script tag failure for valid xhtml”

  1. gerrod says:

    Oh bugger… ! Is that in Internet Explorer 6? I wonder if it’s fixed in 7?

Quickduck logo