I've recently launched a web app written in C#/.net 4.0 making extensive use of jQuery & jQuery UI to give the best possible user experience.
However some users have reported problems when using the site through an iPhone or Android devices.
What is the best accepted method of detecting both iOS and Android? so that I can then tweak the UI for each browser.
Generically speaking, you should detect the browser server side, and then render the correct templates/viewport to the browser. Check the user agent string sent to the server, by the browser - iOS generally contains the substring, "iPhone" and Android uses "Android" followed by the version number ("Android 2.2")
I think the best solution is to try the string
Request.ServerVariables["HTTP_USER_AGENT"]
That will return the word android for android devices so far. Windows is easy to detect. Somebody help me with the other fruit.
See more detailed solution at http://www.codeproject.com/Articles/34422/Detecting-a-mobile-browser-in-ASP-NET
Here's an ASP.NET extension that (apparently, I haven't used it) does all that for you :)
http://51degrees.codeplex.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With