Identifying the Browser | A |
Several classes of web clients could potentially access your site, but for the sake of simplicity, this appendix addresses four possible situations:
1A client that expects HTML
2A Nokia 7110 browser
3A device with the UP.Browser v3.1 or 4.x that supports WML 1.1
4A Mitsubishi Trium browser
To identify which client is accessing your site, investigate two different HTTP headers, HTTP_ACCEPT and HTTP_USER_AGENT. While neither of these is part of the WAP specifications, they are both standard HTTP headers defined in RFC1945 (see
The first step is to look the HTTP_ACCEPT header and parse it for the inclusion of
text/vnd.wap.wml:
■Perl
#!/usr/local/bin/perl
$acc = $ENV{"HTTP_ACCEPT"};
$ua = $ENV{"HTTP_USER_AGENT"}; if ($acc =~ "wml"){
deliver wml
}
else{
print' Location: http://mysite.com/index.html'."\n\n";
}
February 2001 | Genie Application Style Guide 73 |