Is it possible to detect the mobile device model using javascript or ASP.Net

I have a website that will display mobile accessories and I'm thinking that it would be nice if the website was able to detect the user's mobile device that's requesting the page so it would display products for this specific model.

Any way to achieve this in javascript, jQuery or .Net is appreciated. Thanks.

Answers


Detecting the client reliably is not easy, but the best you can do is to look in the user agent string supplied by the client.

In ASP.NET you can access it through Request.UserAgent property.

You will have to find the exact user agents that you want to look for to identify phone models. This is for example my old Xperia Mini Pro:

Mozilla/5.0 (Linux; U; Android 2.3.4; sv-se; SonyEricssonSK17i Build/4.0.2.A.0.58) AppleWebKit/533.1 (KHTML, like Gecko) Vers

Need Your Help

Rust GSL library always returns the same number for a random number generator

random rust

I am using the rgsl library in Rust that wraps functions from the C GSL math libraries. I was using a random number generator function, but I am always getting the same exact value whenever I gener...

High-Order ScalaCheck

scala specifications category-theory scalacheck

Consider the following definition of a category: