Back to the MIME Type Tests.
To hide data from an XML parser, the data should be enclosed in a CDATA
section. The following JavaScript function has been specified in the head
of this document, enclosed in a CDATA
section.
<![CDATA[
function cdataComment()
{
alert('Enclosed in CDATA');
}
]]>
When served as application/xhtml+xml
, the function should be executed. When served as text/html
, the function is ignored. Test JavaScript Function in CDATA.