W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > March 2009

Re: Subtests that apply to HTTP header fields [was: Re: mobileOK validation logic - jar file?]

From: Francois Daoust <fd@w3.org>
Date: Wed, 18 Mar 2009 22:10:12 +0100
Message-ID: <49C16334.9070005@w3.org>
To: "findyourfate.com" <analyst@findyourfate.com>
CC: public-mobileok-checker@w3.org
Hi Stanley,

findyourfate.com wrote:
> Hi
> I have included the mobile validator code as below
> <script>
> var isCE = navigator.appVersion.indexOf("Windows CE")>0;
> if (isCE)
> {
>  window.location.href="http://www.findyourfate.com/mobile/home.html";
> }
> </script>
> if its not a mobile user then the system loads the home page 
> www.findyourfate.com <http://www.findyourfate.com>

There are a few points that may be worth noting here:
1/ you are relying on a script to perform the redirection toward the 
mobile version. Support for scripting is not necessarily available on 
mobile devices, meaning the code may actually not be run at all.

2/ you are only testing for "Windows CE" which represents but a fraction 
of the mobile browsers available on the market.

3/ the script is executed on the client, which means that the mobile 
browser needs to download and parse the page before it can run the 
script and switch to the mobile page. This means more requests and more 
retrieved data. That's a huge cost for mobile devices.

> can you suggest any other simple code, as I see in certain cases this 
> doesnt work.

It all depends on what you are trying to achieve, and the tools you are 
using and/or are familiar with and/or have access to. The easiest way to 
switch between a desktop and a mobile version of your site would be to 
use content negotiation on the server based on the User-Agent sent in 
the HTTP request. For instance, if your server is under Apache, you may 
want to use rewrite rules. See the Apache RewriteCond documentation for 
an example:

To correctly detect mobile browsers and serve content that matches 
browsers capabilities, you might want to use the services of a Device 
Description Repository:


> Regards
> stanley
Received on Wednesday, 18 March 2009 21:10:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:21:20 UTC