Jump to content

Script Parsing Html/xhtml?


mattmill30

Recommended Posts

Hi everyone,I was just reading though the html/xhtml reference for html scripts on w3schools,and it says that in xhtml you should use the following for scripts:<script type="text/javascript"><![CDATA[ document.write("Hello World!") //]]></script>instead of the html version which is just<script type="text/javascript"> document.write("Hello World!") </script>It says the reason is because of the way the html/xhtml parses the entities within the script.What does this mean?and how come i need to wrap the scripts in <![CDATA[//]]> when scripting in an xhtml document?Thanks,Matthew Millar

Link to comment
Share on other sites

It may be worthy of note that in Firefox XHTML is not parsed unless the extension is .xhtml

Link to comment
Share on other sites

It may be worthy of note that in Firefox XHTML is not parsed unless the extension is .xhtml
No, that's not exactly correct. It will only parse a page as XHTML if the content is served as application/xhtml+xml. (Usually done with a header sent from the server).Internet Explorer does not support the XHTML MIME type.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...