Sunday, September 23, 2007

Google's GWT

Transcoding is a hot topic these days in the mobile community. Google's GWT has come up a couple of times in some conversations I had in the last 2-3 weeks. I never wondered how they decide to transcode or not, anyway.
I gave it a shot today using cURL and an emulator to get access to some devices quickly.

How I did it
I got on http://www.google.com/m and searched for "WURFL test"; I left the default "Web" setting. As expected my http://t.wurfl.com was the first link. I clicked on it and got to the page, the layout was unchanged, but that's not a surprise, it's so simple. Scrolling down I noticed that the user-agent string is not my phone's, but an ugly generic MSIE user-agent string. Scrolling down a bit more I noticed the standard chrome provided by GWT that lets you disable images or request the page in the original source.

The solution
I sent an e-mail to Sean Owen, who is in the W3C MWI with me. Surprisingly he replied on a Sunday and was very helpful. He explained me how their crawler is able to mark mobile sites and make sure the GWT will not transcode anything. The problem is that at the moment this magic feature is available in the US only and will be rolled out to the world soon. Since I left "Web" in my search I got the web version of my site (t.wurfl.com has a very basic device detection that provides different markup based on the Accept headers). US users should already get the mobile version of t.wurfl.com. Anyway, Sean also suggested a trick that now provides the mobile version to all mobile users without any other update required. I added the following tag in the head of the page:
<link rel="alternate" media="handheld" href="http://t.wurfl.com/index.php">

Seconds after the update I requested again the page with the emulator and got the mobile version.

PS: if you want to get a mobile page using cURL you can do this:
curl -D - -A "Nokia6600" "http://www.google.com/gwt/n?u=t.wurfl.com/"

You will see the page source and the HTTP headers sent by the server. Read the manual for more commands, cURL is super-powerful!

2 comments:

srowen said...

I'm not sure I was clear in my response. The link tag technique is actually unrelated to the crawler, or to the new search interface that is currently only seen on google.com/m. This is a function of the Google Transcoder, and it works everywhere.

You can use this technique to get the transcoder to redirect to a mobile version of the given page. In the case of t.wurfl.com, you could use it to tell the transcoder that t.wurfl.com itself is the mobile version. The user gets a redirect rather than a transcode.

Links to "Web" results are always put through the transcoder. "Mobile Web" results never are. t.wurfl.com has been crawled/indexed as both a web and mobile web result, so will appear in both result sets. So this technique only has bearing on "Web" results; the site would not be transcoded in "Mobile Web" results to begin with.

Fortunately the new interface, which has been active in the US for a while and is rolling out to the rest of the world, does not make you choose between Web and Mobile Web. t.wurfl.com appears in the combined result set as a mobile site, so is not transcoded by default anyway.

Still I think it's useful to apply the technique Andrea mentions for the benefit of other transcoders, and for users of the old mobile search UI at Google who find your site via Web search.

Andrea Trasatti said...

I wrote the post a bit in a rush and it's possible that I wasn't clear. It was clear in my mind, but it's good you explained better to all the others.

Thank you again