Detect iPhone?

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.
 
S

Stanimir Stoyanov \(C# MVP\)

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".
 
H

Hillbilly

I was expecting this to be returned by the Request.Browser.Id property but
parsing the UA string contains more data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top