Detecting Mobile Browsers
Posted: Wed Dec 20, 2006 12:54 pm
I have a request to automatically detect the browser and output a mobile version of the website.
This worked fine when it was just supposed to support BlackBerry as they have an extra variable set called $_SERVER["HTTP_PROFILE"]
Now I am supposed to add support for Windows CE and Palm, CE was easy enough to find a working emulator and add it's own variable. Palm I am having issues. This can get huge fast if I'm checking for a certain variable in each type of mobile browser and not a good design choice.
My question, is there an efficient way to detect mobile browsers?
I know I could use the HTTP_USER_AGENT string and try to parse for different type of OS's. The problem there lies knowing which ones to detect for any knowing the difference between the many types out there.
The goal is not to have to create a new ip name, ex. mobile.xxx.xxx and use the current name.
This worked fine when it was just supposed to support BlackBerry as they have an extra variable set called $_SERVER["HTTP_PROFILE"]
Now I am supposed to add support for Windows CE and Palm, CE was easy enough to find a working emulator and add it's own variable. Palm I am having issues. This can get huge fast if I'm checking for a certain variable in each type of mobile browser and not a good design choice.
My question, is there an efficient way to detect mobile browsers?
I know I could use the HTTP_USER_AGENT string and try to parse for different type of OS's. The problem there lies knowing which ones to detect for any knowing the difference between the many types out there.
The goal is not to have to create a new ip name, ex. mobile.xxx.xxx and use the current name.