However if you are providing your sites from the same server and want to havesignificantly different sites for your mobile vs. wired users then you don'twant to be limited by the HawHaw emulator for the desktop clients. The following simple approach allows a switch between pages to be made dependanton the client's capabilities. It does not rely on BrowseCap.ini or GetBrowserfunction to work. Thanks to Norbert Huffschmid for explaining what I was doing wrong with my experiments.
1) Create a page for HTML (in my case it was simply the old Index.html) and rename it to index2.html. You can't use index.htm as that would be used first.
2) Create a page for mobiles clients, either manually or via HawHaw. In this case it's called index.wml.php
3) Create a page index.wml as below. This will be the page that all clients will be routed through. It will do a simple detection of the facilities of your browser and switch to the appropriate pages. (see separate article for setting up the index page correctly)
require_once("hawhaw.inc.php");
$myPage = new HAW_deck("Test desk");
if $myPage->ml == HAW_HTML & & $myPage->pureHTML)
{
header("Location: /index2.html");
die;
}
else
{
include "index.wml.php";
}
?>
No comments:
Post a Comment