Hi Justin et al,

Yes you are right that user agent field is not always reliable but 98% of the time you will be able to tell if it's a mobile or a pc. That's good enough. If someone fakes the header they will just get a wrong content type and no harm done. I first did a wap site with php using this method way back in 2000. Unidentified browsers were given html.

As for a detailed list of various mobile browers, it's impossible to maintain this list. That's why there is a sourceforge project that does it and we can all benefit.

did i mention xslt?



Justin French wrote:

On Sunday, October 12, 2003, at 12:02 PM, Manuel Vázquez Acosta wrote:

Take a look at what is printed by:

var_dump($_SERVER);

Maybe the HTTP_USER_AGENT can lead you to somewhere out of this problem.

Manu.

"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Hi,

I have created an online system, and have created a WAP version, and am
currently crreating a PDA version. What I wuold like to to do is give out
the same URL instead of domain.com for normal use, domain.com/wap/ or
domain.com/pda/. Is there a way of detecting what device is loading the

site


and redirect them accordingly?

Thanks for your help



Manuel, Shaun,

$_SERVER['HTTP_USER_AGENT'] (just like anything else from the client side) can't be trusted to either exist, or to be correct. Some user agents don't set this value, and it's quite easy for it to be faked. More to the point, there's no way you can possibly account for all possible user agents out there... perhaps only the popular ones.

So, $_SERVER['HTTP_USER_AGENT'] is a good starting point or method for guessing where to send people, but it's not fail safe AT ALL.


I think the fail safe way is to create pages which are standards compliant (XHTML strict) and use CSS for all styling/presentation, which means your pages will accessible via the largest possible number of viewing devices, like PDA, WAP, text-to-speech, desktop browsers, Web TV, etc.


The move away from table based layouts and poorly accessible webpages is a big one, but not THAT big :)


Justin



-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to