More in this section

Forums / Developing with Sitefinity / Mobile Device Type Detection in Sitefinity

Mobile Device Type Detection in Sitefinity

3 posts, 0 answered
  1. MB
    MB avatar
    302 posts
    09 Jan 2005
    18 Jun 2015
    Link to this post

    To make my responsive sites offer a better experience, I want to be able to detect the type of mobile device and make decisions. e.g. A tablet might be able to display something that a phone can't.

    Obviously, browser agent sniffing is a nasty no-go, but the standard ASP.NET Request.Browser.IsMobileDevice property makes no distinction for the device type other than it's "mobile".

    I'm interested in what others do, and whether anyone has experience with using 3rd party solutions with Sitefinity, such as 51Degrees - which is slick but involves extra $$.

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    06 Sep 2017
    22 Jun 2015
    Link to this post
    Hi Mike,

    You can try the approach discussed in that forum:

    Svetoslav Manchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  3. MB
    MB avatar
    302 posts
    09 Jan 2005
    22 Jun 2015 in reply to Svetoslav Manchev
    Link to this post


    Funny you should say that, as I'm ​currently testing a piece of code I wrote, which is a slight modification to code I "borrowed" from the bottom of that forum thread

    private static bool IsTablet(string userAgent, bool isMobile)
        var r = new Regex("Tablet|iPad|PlayBook|BB10|Z30|Nexus 10|Nexus 7|GT-P|SCH-I800|Xoom|Kindle|Silk|KFAPWI", RegexOptions.IgnoreCase);
        var isTablet = r.IsMatch(userAgent) && isMobile;
        return isTablet;

    Called as:

    IsTablet(Request.UserAgent, Request.Browser.IsMobileDevice);

    This seems to work for common tablets, but I'm not so sure of the various convertables, and is obviously prone to being broken by the Mobile/Tablet market - where new devices appear at an alarming rate.

    The 51Deg solution has some attractions in that is regularly updated (weekly) and more advanced in its agent-string analysis, but the downside is obviously the extra $$ (although not so bad if running multiple websites on the one host - sounds like I'm talking myself into it - LOL) and I am unsure if the httpHandler (which basically intercepts all requests) will interfere with Sitefinity.

3 posts, 0 answered