How to add JavaScript to Blogger template

Leave a Comment
If you want to add a javascript script in blogger template we have to use the following syntax:
<script type='text/javascript'>
//<![CDATA[
... code ...
//]]>
</script>
With that we tell Blogger that the contents within the CDATA tag is text that does not have to analyze, because as you will see what XML tags inside the file to form the website. So if we have special characters within your XML script he's playing and we can not keep our staff and a possible error that will give us will be:
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The content of elements must consist of well-formed character data or markup.
Another way would be to replace special characters with escape characters (as explained in this other post),but it is not at all efficient, P
If It was helpful coment and share!

0 comentarios:

Publicar un comentario