Blog » XHTML, Google Adsense, and Firefox 2

XHTML, Google Adsense, and Firefox 2

EDIT (2008/06/26): I have since encountered more problems with XHTML and Adsense, and have come up with a much simpler, and more effective, solution.  

I've been having some trouble getting Google Adsense up and running. Internet Explorer displayed the ads fine, but in Firefox, it was as if they didn't even exist. Searching Google's Adsense knowledge base brought no solutions.

The first clue that I got as to what was wrong came after I had installed Google Analytics. By this point I had realized that it was a Javascript problem. So I installed Firebug, and let it run on this site. Firebug allows you to debug Javascript (amongst other things). It came up with three errors, similar to:

  • object could not be created in this context
  • object could not be created in this context
  • _gat is not an object 

Ok, so the object _gat is not being created properly. Searching the internet finally gave the solution, courtesy of Weston Ruter. The problem is that Firefox 2 doesn't support the document.write() method in XHTML documents. Google's Adsense and Analytics code makes use of this method.

I'm surprised that they don't put this solution in their knowledgebase. Firefox 2 is used by enough people that it matters when things don't work in that browser. Anyway, it's all working as it should now. Thanks Weston Ruter.



Blog » XHTML, Google Adsense, and Firefox 2

Post your comment

Comments

  • you let me know more,thanks

    Posted by fun, 11/05/2011 4:34am (14 years ago)

RSS feed for comments on this page | RSS feed for all comments


Blog » XHTML, Google Adsense, and Firefox 2