SEO – not on your handheld

I’m often surprised by the poor quality code that appears on the Web in the name of Search Engine Optimisation (SEO). Where does this nonsense originate from?

Recently I came across an example of something that, despite thinking about for some time, I can’t understand why anyone would think was a good idea.

This piece of CSS appeared in the XHTML of a tables-based Web site’s homepage:

<style type="text/css" title="text/css" media="screen">
#pdahide { display: none; }
</style>

<style type="text/css" title="text/css" media="print">
#pdahide { display: none; }
</style>

<style type="text/css" media="handheld">
table.headertable, td.columnone{display: none}
body{background: none;}
#pdahide { display: block; }
</style>

The main content of the page was in a table that had a class of ‘headertable’. Outside of this table was a div with an id of ‘pdahide’. The div contained text describing the function of the site and its intended audience.

The purpose of this code appears to be to hide the entire content of the Web page if a user-agent is using the handheld stylesheet and only display a bit of text explaining the purpose of the site (which is useless since you can’t then access it from your PDA or phone etc.). Usually I’d pass this off as incompetent coding but, in this case, the HTML contained comments that clearly identified these changes as being part of an SEO activity.

I wonder if the thinking is that a tables-based site may not work well on a small screen? However, is it for the site’s owners to decide what devices the site will work on – clearly not, it should be designed to work on all devices! How can someone seriously make a business case out of the above code, go on have a go: “We think it’s a good idea to exclude these sorts of users from your site because…..”

Given that search engine spiders will pay no attention to the CSS used on a site and will only read the page content (XHTML) the above just disadvantages users wanting to access the site using a handheld device.

In fact, given the positioning of the “handheld only” content this will be the first bit of content to appear in the page and hence the first bit of content catalogued by the spider. Is this then an incompetent attempt to get a bit of explanatory text about a Web site to appear in search results? (Aside from the fact that surely your homepage should explain the purpose of the site anyway and that you shouldn’t be hiding content like this.) If so, why use a handheld stylesheet to do this? Given that the spider will not ‘see’ the page as it’s rendered in the browser why not just hide this content from normal users using an associated class in the main stylesheet, or do nothing, the page had a dc.description anyway?

Maybe I take an uncommon moral high-ground but I couldn’t recommend the above changes to a client of mine. This activity offers no SEO advantages that I can see and actively disadvantages an increasingly important group of Web users (i.e. those surfing the Web using a handheld device).

If anyone can explain why the above might be a good idea I’d love to hear from you…