开发者

chrome browser not showing google ads for xhtml file

I am trying to display google ads on xhtml file, but chorme browser down't show them up. The ads show on all other browsers I tried (Ie,firefox,opera) but chrome. Has anyone encountered this before? Small sample code:

    <html xmlns="http://www.w3.org/1999/xhtml">
   <body>
<script language="javascript">

 google_ad_client = "pub-4942221729702985";
 google_ad_slot = "0095628928";
 google_ad_width = 728;
 google_ad_height = 90;
 </script>
 <script language="javascript"
 src="http://开发者_JAVA技巧pagead2.googlesyndication.com/pagead/show_ads.js">
 </script>
 </body>
   </html>

Thanks Smitha


The problem is google js file uses document.write, which is not allowed in a application/xhtml+xml page

I guess this will solve your problem

http://www.cromwell-intl.com/technical/google-adsense-and-xhtml.html

http://ejohn.org/blog/xhtml-documentwrite-and-adsense/

http://randsco.com/index.php/2005/11/10/serving_xhtml_with_the_right_mime_type

The W3C recommends that ALL XHTML documents be served as "application/xhtml+xml". This is because XHTML requires more strict validation and the code doesn't contain the myriad of diverse tags (AKA "tag soup") that need be supported in "text/html" (one benefit is that XHTML renders faster).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜