How to avoid parsing error in Blogger Template editor when adding HTML or Javascript codes


Do you hate it whenever you found a suitable Javascript in the internet and when you copy and pasted it onto your Blogger template editor only to find out that it is giving out parsing error. Errors like it illegal characters for < , > or " and all of them needed to be replace with &lt; , &gt; or &quot; .



Well it is not because the Javascript code is incorrect but rather Blogger template codes are in XML and Javascript code works in HTML. XML and HTML code syntax does not play well together. There are two solutions to this.

The first solution is to convert the Javascript codes into XML compatible or friendly. To do that, you need to search for online converter like http://www.blogcrowds.com/resources/parse_html.php.

The second solution is to use CDATA tags. Use the tags inside the <script></script> tags. Here is an example.

Javascript found in the internet:
<script>
    Your Javascript codes.
</script>

Javascript with CDATA tags that is friendly to Blogger template.
<script>
//<![CDATA[
    Your Javascript codes.
//]]>
</script>


Comments

Popular posts from this blog

City Code Table for Casio SGW300HD-1AV Watch

How to force only 4G or LTE network connection for Samsung Galaxy Note 4

Mounting NFS share directory from D-link DNS 320L on Ubuntu 12.04 LTS