Wednesday, September 07, 2011

Parsing Google Adsense ad code manually

Parsed Google Adsense ad code is normally used when someone directly needs to put that ad code in the HTML of a blog or website, or in the source code of a document. All you need to do is to replace
  • < with &lt;
  • > with &gt;
  • " with &quot;
in the code and your Google Adsense code will be parsed.

For example, if your Google Adsense code looks like:

<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxx";
/* 300x250*/
google_ad_slot = "yyyyyyyyyyyyyy";
google_ad_width = 300;
google_ad_height = 250;
<script type="text/javascript"

Then the parsed form of this code will be

&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-
/* 300x250*/
google_ad_slot = &quot;
google_ad_width = 300;
google_ad_height = 250;
&lt;script type=&quot;text/javascript&quot;

I only removed < and added &lt; and removed > and added &gt; and removed " and added &quot; respectively every time they occur in the code.

No comments:

Post a Comment

Ali Khan Blogs ( is a Blog about Blogging, SEO Tips and Tricks, Anime, Engineering and Jobs