Archive for the ‘JavaScript’ Category

Track Download Links Using jQuery and Google Analytics

Wednesday, October 22nd, 2008

Once you’ve got Google Analytics working, you can use jQuery to easily track other links on your site, such as download links.

(more…)

JavaScript Does Not Validate

Tuesday, October 4th, 2005

Remember to put CDATA tags around the actual JavaScript code if it uses < or &. See Script and Style elements at the W3C. For example, use:

<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>

Actually, the above does not work correctly in Mozilla browers such as Firefox. See Properly Using CSS and JavaScript in XHTML Documents. They recommend putting everything in external files. If that’s not possible, use a modification of the above code:

<script type="text/javascript">
//<![CDATA[
... unescaped script content ...
//]]>
</script>

Useful Validation Links: