Determinr Mobile Device RRS feed

  • Question

  • User969992919 posted
    Hi What is the best way to determine if device is mobile? Is (isMobile) a good way?
    Friday, June 15, 2012 1:37 PM


All replies

  • User1014742505 posted


    This will provide the answer you are looking for.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 15, 2012 1:44 PM
  • User-1438829842 posted

    You need to understand.. UserAgent you can use this


    Redirect Mobile Devices

    <script type="text/javascript">
    if (screen.width <= 699) {
    document.location = "mobile.html";

    For iPhones/iPods Specifically

    <script language=javascript>
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {

    Or u can use Page_Load

    HttpBrowserCapabilities Version = Request.Browser;
    if ( Version.IsMobileDevice = true)

    Good luck` Mark those Post as Answered if they really helped you.. No matter you can Mark Multiple Post as Answer.

    Friday, June 15, 2012 4:09 PM
  • User-1362038177 posted

    If you do not want to play with UserAgent by yourself, the solution most users use is the 51Degree API.

    Please check it out on the following codeplex project:


    Friday, June 15, 2012 8:08 PM
  • User71929859 posted


    You can use 

       //Code here

    But according to this article, it won't detect some phones. In that case, you can use the solution posted there. 

    Saturday, June 16, 2012 9:07 AM
  • User1943143334 posted


    Check the below link, which provides the code for different languages!


    Hope it helps u...

    Saturday, June 16, 2012 10:26 AM
  • User969992919 posted
    If you were given an option, will you choose to do it using UserAgent / isMobileDevice or go for 51degree? What is your advise?
    Sunday, June 17, 2012 10:16 AM
  • User1943143334 posted


    I prefer doing it using UserAgent! I feel it's a feasible option, since UserAgent string can be fetched from JavaScript as well as ServerSice Code!

    Moreover, IsMobileDevice works fine only in ASP.NET MVC4!

    Hope it helps u...

    Monday, June 18, 2012 12:38 AM