Making The Google Custom Search Bar XHTML Compliant

Google has offered a customized search bar for webmasters to add to their page for quite some time now. But like many other things from Google the code they give you is old deprecated HTML, this is very likely to cause trouble for newer sites that are trying to make their documents XHTML compliant.

If you take a close look at the code Google gave me when I wanted to add my own custom search bar (use your browser’s “Show Source”-feature) you’ll notice many deprecated techniques like: tags are written with CAPS, not appropriate ending of tags, style information embedded into the tags, etc.

It isn’t very hard to fix it and make it XHTML compliant, but if you would like the solution right away you can check out how I solved it (”Show Source” again). And it now validates as XHTML 1.0 Transitional.

Note: Of course you should change the values to match your URL!

4 Responses to “Making The Google Custom Search Bar XHTML Compliant”

  1. Jamie Hill Says:

    Hi there,
    I am very impressed with you making the Google search engine xhtml compliant. I am trying to include your modification in my own site. I am still learning at the moment. I need to ask you how do I correctly include your modified search engine in my site. I have tried but it doesnt bring back any results, however on your site it works perfectly. I am doing an experiment where the site can be seen on xhtml mobile phone browsers, so your xhtml engine would be perfect. The only thing I want it to find is hyperlinks on other pages. I have updated my own web address in the fields, however I wanted to ask what the below means;

    In particualr the AH:center; and so on, could I ask you to take a look, I’ve asked on various forums, but nobody seems to know. I’ve used java script based search engine programs, they work very well but mobile phones dont support java script. How does it index the site?

    Can you help?

    Thanks

    J

  2. Bachu Says:

    Hi, my site is http://www.innovateidea.com in xhtml1.1 & 1.0, I have all my pages valid according to the w3 standards, but why is that w3.org itself has few invalid pages, over 10 pages.

  3. nlindblad Says:

    I guess no one is perfect :)

  4. Following Up On the Google Search Bar Issue « Niklas Lindblad Says:

    […] custom search bar that is given to you by default validated with no more than 56 errors (see the full story […]

Leave a Reply