Call (877) SITE-OPT (748-3678)

Code: Remove JavaScript Comments

Chapter 8 - Ajax Optimization

You can safely remove all JavaScript comments indicated by // or /* */. They offer no value to the typical end-user and just increase file size. You do need to be aware that script-masking comments such as this:

<script type="text/javascript">
<!--
    alert("code here");
//-->
</script>

might be useful to preserve in the case of non-JavaScript-aware bots or old browsers. It is probably best to include scripts outside the document, however, as it is easier to make them XHTML-compliant.

Copyright © 2002-2017 Website Optimization, LLC. All Rights Reserved - Free website speed test - Privacy Policy
Last modified: February 19, 2009.

Follow us on: Twitter, Google+, Facebook, Linked In