- From: Francois Daoust <fd@w3.org>
- Date: Wed, 18 Mar 2009 22:10:12 +0100
- 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: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond To correctly detect mobile browsers and serve content that matches browsers capabilities, you might want to use the services of a Device Description Repository: http://www.w3.org/Mobile/Dev#ddr Thanks, Francois. > > Regards > stanley >
Received on Wednesday, 18 March 2009 21:10:49 UTC