Search code examples
c#detectiontablet

Tablet vs phone detection with 51degrees.mobi


I am trying to find a way to determine a mobile device as a phone or a tablet. I am using the C# library by 51Degree.mobi (http://51degrees.codeplex.com/). I see that the there is already a IsMobileDevice property on the Browser object so I know whether it is a mobile device or not but now I am looking for another property IsTablet (or some other way to figure out that). I suppose I can base that decision on the screen size, but that doesn't seem solid.


Solution

  • It's configurable within your web.config. You would use the is_tablet check and write something like:

    <location name="tablet" url="/Tablet/Tablet.aspx">
       <add property="is_tablet" matchExpression="true"/>
    </location>
    

    See: http://51degrees.mobi/Support/Documentation/Foundation/UserGuide.aspx for their complete guide.