One of the reasons I changed a random content rotation script that was sitting in my <head>
tags last month was because this JavaScript failed to validate. I don’t intend to change back – but today I found out the why-for when I came across the same thing happening in two versions of “The Son of Suckerfish”. One wrapped the JavaScript with CDATA tags the other not. That simple. Of course removing the script into its own file would do the trick too.
Don’t forget to wrap up your script tags safely!
<script type="text/javascript"><!--//--><![CDATA[//><!--
PUT YOUR CODE IN HERE
//--><!]]></script>
This applies to all XHTML pages.
Last updated on 5th September 2018
Leave a Reply