Tuesday, May 25, 2010

The Saga of aix-consulting.net attempts to use spry

The pages served by this Rails application are of type application/xhtml+xml. Here is a long chain of events to bring this about.

I wanted three things:

  1. I wanted to use spry
  2. I wanted to use Google adsense.
  3. I wanted my pages to validate.

These three desires clashed and the saga begins.

Spry uses custom attributes like:

 <tr spry:repeat="dsProducts" spry:hover="hover" spry:suggestion="{name}">
   <td><div class="boxshot"><img src="../../demos/products/{boximage}" alt="{name}" /></div><div>{name}</div></td>
 </tr>

The spry:repeat= spry:hover= etc are all non-standard attributes for the <tr> tag. The validator complains about these.

To solve this, the DTD must be modified to be:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  [
     <!ENTITY % SPRY SYSTEM "http://www.adobe.com/dtd/spry.dtd">
     %SPRY;
  ]>

This tidbit came from here.

But, as that page notes, when this is served as an html document to all the browsers except Opera, you get:

 %SPRY; ]>

at the top of your pages.

To solve this, the page needs to be served as application/xhtml+xml -- I can't remember where I found that tidbit of information.

But, now Google adsense is broken. The reason is here.

So, as is suggested in the above reference, the Google adsense are put inside an object tag. The page that the object tag references is served as Content-type of 'text/html' so now adsense works.

But, as I have recently found out, all this works fine in Firefox 3 but not in Opera or Safari. So, at this point, and also due to other encounters, spry is on the way out. It just doesn't work for me -- too many obstacles to make it work.

No comments:

Post a Comment