Making AdSense work with XHTML

You’ve applied and been accepted by Google to add AdSense to your site but, because you are serving your pages correctly as application/xhtml+xml, the ads are failing to display.

Google AdSense uses the JavaScript function document.write() for the ads and when XHTML is served as ‘application/xhtml+xml’, document.write() doesn’t work. Also the ads are embedded in an iframe, which is not allowed
My blog still work correctly but when I put it in another cms scripts then it isn’t valid XHTML, why are you don’t load it as html page? Let’s try!
To overcome this I created a separate code snippet which includes the javascript and a little styling, and embeded this in my page using the object tag.

the code snippetads.htm

<body style="overflow:visible; border:0px; padding:0; margin:0;">
<script type="text/javascript">
<!--
your Adsense parameters here
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</body>

xhtml

<div id="ads">
<object data="ads.htm" type="text/html"
width="468" height="60">
</object>
</div>

Change the width and height to suit your selected ad format.
Style the “ads” div as you wish, or simply not use it.