mattmill30 Posted June 30, 2009 Share Posted June 30, 2009 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 More sharing options...
Ingolme Posted June 30, 2009 Share Posted June 30, 2009 So that characters & and < do not affect the XML parsing of the document. Link to comment Share on other sites More sharing options...
Anman Posted July 2, 2009 Share Posted July 2, 2009 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 More sharing options...
Ingolme Posted July 2, 2009 Share Posted July 2, 2009 It may be worthy of note that in Firefox XHTML is not parsed unless the extension is .xhtmlNo, 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.