I am adding some Javascript generated by Google's Adsense on my page, but there is somethong which does not make sense to me:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1234324234324324";
/* LeftTop */
google_ad_slot = "2343454355";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Why does Google add !-- at the beginning of the first script and //-- at the end? What is the purpose of this code? What does it do? Is it really necessary?
I saw this from here:
Why do we place JavaScript code inside comment fields ? It's for ensuring that the Script is not displayed by old browsers that do not support JavaScript. This is optional, but considered good practice.
It's supposed to make browsers that don't support Javascript ignore everything inside the <script> block by making it look like a HTML comment. It's rarely used nowadays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With