Jump to content

Script Parsing Html/xhtml?


mattmill30
 Share

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...