[thelist] Browser Issue

Edwin Martin edwin at bitstorm.org
Wed Mar 18 03:47:46 CDT 2009


Alexander Freiria,

> I found out the issue with my page though, I'd appreciate an explanation why
> this code will cause my page not to render correctly in IE7 and Firefox; it
> works in Google Chrome...
> 
> <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"
> type="text/javascript" />

I see what your problem is.

You stumbled on one of the differences of html versus xhtml.

In html, you always have to write <script ...></script>

Your notation <script .../> is a newer xhtml notation.

You probably think "I have a xhtml doctype and coded my page as xhtml, 
so it should be parsed as xhtml".

Unfortunately, that's not the case. An page is only parsed as xhtml when 
a xhtml content-type is send by the webserver.

Otherwise, the browser will act like it is a html page. That's right, 
the browser will parse your xhtml page just like it was a html page. 
That's why it breaks when entering a <script> and never seeing the 
closing </script>.

Ofcourse now you're asking about the content-type. "Just let the server 
spit out this xhtml content-type." Well, there is one problem: Internet 
Explorer doesn't understand this content-type. Yes, after all these 
years, it's still uncapable of rendering xhtml. Stupid browser.

Well, I hope you understand now.

Edwin Martin



More information about the thelist mailing list