Amazon Associates & XHTML Validation

21
Aug
2007
Amazon Associates & XHTML Validation
Posted by Shawn | delicious digg reddit

I recently added Google and Amazon advertisements to keelingdesign.com. This is quite simple to do with the Drupal modules Adsense and Amazontools. Setup and installation not only requires configuring ones's Drupal site but also requires that one join Google Adsense and Amazon Associates respectively.

The only snag I encountered was that my site failed XHTML validation after I enabled my ads. The culprit turned out to be Amazon's "Product Links" which provides code for insertion in your document. The code includes the iframe tag which is not XHMTL 1.0 Strict. As a result, all pages with Amazon adds returned several red errors when checked for validation. There is however a solution.

The iframe tag is valid XHTML 1.0 "Transitional", so one only need change the document type from 1.0 Strict to 1.0 Transitional. This is rather easy to do in Drupal. Simply open your page.tpl.php file and change the DOCTYPE to:

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

Now all pages with Amazon ads will pass validation.

Posted in:
|0 comments |printer friendly version

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <blockquote> <pre> <em> <img> <strong>
  • Lines and paragraphs break automatically.
More information about formatting options

Compose Tips