tags:

views:

307

answers:

1

Hi,

I created a iphone/blackberry compatible design for a website. If the website is xxx.com, iphone/blackberry compatible design is at xxx.com/m. How do I detect iphone/blackberry users and make sure website redirects them to the compatible design.

A: 

Your best bet is to go with a UA detection script/library. One I found for ASP is here:

http://mobiforge.com/developing/story/lightweight-device-detection-asp

If the script does not offer the flexibility you want or is too complex for your needs, Request.ServerVariables("HTTP_USER_AGENT") will return a user agent string that looks like this:

BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102

In my experience, all BlackBerry browsers include "BlackBerry" in the UA string, and all iPhones include "iPhone" in the UA string, so you can run simple string manipulation on that. I'm a PHP man, so I can't help you write something off the top of my head, but if you need a sample code, post a comment and I or someone will get one out to you.

Steven Xu
Thank you so much, HTTP_USER_AGENT should do it.
Efe Tuncel