Home > Articles > Home & Office Computing > eBay/Yahoo/Google

  • Print
  • + Share This
Like this article? We recommend

Use GWT in Your Web Site

Google Wireless Transcoder can be used as a handy temporary solution when you’re faced with the task of making your web site accessible to mobile devices with minimum investment. If visitors arrive at your site through the Google search engine, the transcoder is used automatically (it’s inserted into the search results produced by Google). Thus, you just have to handle visitors arriving at your site through external links or by typing your web site URL into the browser’s address bar. The fix is conceptually simple: Whenever your site detects a visitor using a mobile device, it redirects the visitor to the same page, but piped through GWT. After GWT gets involved, all the outgoing links of the transcoded page are modified to use GWT, so no further checks are needed on your end.

If most of your pages use server-side scripting (for example, most of your web site is composed of ASP or PHP pages), and you use a common library that’s included in all of the scripted pages, the implementation is very simple: Insert the necessary code in the common library. If your web site doesn’t fit this ideal model, you could decide to implement the solution solely on your home page or on just a few major landing pages.

To use GWT from your web pages, you have to perform the following tasks:

  1. Identify that the visitor is using a mobile device.
  2. Redirect the visitor to GWT if your web pages wouldn’t display correctly on the mobile device. Alternatively, you could insert a hyperlink at the top of the page, offering a mobile version of the page.

WAP-compliant devices are easy to recognize, based on the Accept: headers sent by the browser:

  • The XHTML Mobile Profile specifies the application/vnd.wap.xhtml+xml MIME type.
  • WML 2.0 (part of the WAP 2.0 standard) uses the application/wml+xml MIME type.
  • WML 1.3 uses the text/vnd.wap.wml MIME type.

Identifying PDA-based mobile browsers is more difficult and usually has to be based on the User-Agent: HTTP header. Each browser requires a different check; for example, you can recognize Safari on iPod/iPhone (read the section "Optimize for Page Readability"), Internet Explorer Mobile, Pocket Internet Explorer, or Mobile Opera.

Let’s conclude this discussion with an example.

  1. Compute the Google GWT URL corresponding to the current page:
    GWT = "http://www.google.com/gwt/n?u=" + _
       Server.URLEncode ("http://" + _
        Request("SERVER_NAME") + Request("PATH_INFO"))
  2. Try to identify some of the common mobile platforms:
    WAP = InStr(Request("HTTP_ACCEPT"),"wap") > 0 Or _
       InStr(Request("HTTP_ACCEPT"),"wml") > 0
    PDA = Instr(Request("HTTP_USER_AGENT","Windows CE")) > 0 Or _
       Instr(Request("HTTP_USER_AGENT","Mobile")) > 0 Or _
       Instr(Request("HTTP_USER_AGENT","Symbian")) > 0
  3. It’s senseless to display the standard web pages on the WAP platforms; those visitors should be redirected to GWT immediately:
    If WAP Then
     Response.Clear
     Response.Redirect GWT
     Response.End
    End If
  4. On the other hand, visitors using PDAs should see the original web page and have an option of viewing the same page through the Google transcoder, so we insert a hyperlink at the top of the page:
    <% If PDA Then %>
    <p class=’pdaLink’>View the same page 
     <a href=’<% =GWT %>’>optimized for mobile platforms</a></p>
    <% End If %>
  • + Share This
  • 🔖 Save To Your Account