Detect iPhone?

  • Thread starter Thread starter Hillbilly
  • Start date Start date
H

Hillbilly

I can detect mobile devices in code but how would I detect a specific device
such as the iPhone? Its one of the few devices with a browser that can load
and display the websites I work on. I want to detect and redirect all other
mobile devices to a site developed using XHTML-MP.
 
You can determine what the device is (and thus if it is an iPhone or iPod
Touch) by checking the user agent string sent by the client.

It should suffice to ensure that the words "Apple", "Mobile" and "Safari"
are all present. You can do this with three separate checks or one regular
expression of the sort "Apple.*Mobile.*Safari".
 
I was expecting this to be returned by the Request.Browser.Id property but
parsing the UA string contains more data.
 
Back
Top