PDA

View Full Version : If browser = mobile device?


Tjobbe
January 19th, 2006, 17:17
I'm trying to make a simple Web page that can detect one way or another if the device is a mobile handset or a normal pc/ laptop. And then redirect them appropriately.

Has anyone done this before, is it possible to snuff out a mobile phone and send them to a wap enabled / low graphics page before any content loads up?

Christina
January 19th, 2006, 19:10
I'm not sure but came across this (http://www.xml.com/pub/a/2004/04/14/mobile.html?page=2).

BigBison
January 21st, 2006, 03:38
http://www.iwdn.net/showthread.php?t=104

Yeah, there's a lot there. Instead of browser detection, though, you could solve this problem with CSS. By providing an external stylesheet designated as "handheld", all SSB (small-screen browser) devices will automatically choose that style.

Simply put, first check the ACCEPT header for "application/xhtml+xml" support, then grep it for "wap". There are lots of variations on "application/x-wap" or whatever, but my method will reliably separate out all WAP 2 (modern) cellphones.

Expanding the detection to include other mobile browsers is more complicated.