locked
Discovering Browser Type RRS feed

  • Question

  • User-2007211659 posted

    Hi all, I'm fairly new to mobile web development.

    I was just wondering if it's at all possible to have a normal ASP.NET site that would have a mobile counterpart with an entry page that would just be code determining whether the user was using a normal browser, or some type of mobile device so the page could then redirect them to the respective correct page.

    Sound doable?  If so, can anyone please provide a code example?

    Thanks in advance!

    Tuesday, May 8, 2007 1:30 PM

Answers

  • User-1573490007 posted
    Of course. If you have a page without UI, that within the Page Load, has something along the line of (pseudo-code) if( Request.browser.IsMobileDevice) { Response.Redirect(somepage);} else { Response.Redirect(SomeOtherPage);}

    That should do it. However only mobile devices recognised as such will return true on the mobile device check, so if you encounter devices that are treated as normal browsers by that snippet, you'll have to note down their browser agents or something and add new browser definitions to your web site.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 8, 2007 1:35 PM

All replies

  • User-1573490007 posted
    Of course. If you have a page without UI, that within the Page Load, has something along the line of (pseudo-code) if( Request.browser.IsMobileDevice) { Response.Redirect(somepage);} else { Response.Redirect(SomeOtherPage);}

    That should do it. However only mobile devices recognised as such will return true on the mobile device check, so if you encounter devices that are treated as normal browsers by that snippet, you'll have to note down their browser agents or something and add new browser definitions to your web site.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 8, 2007 1:35 PM
  • User-2007211659 posted
    Awesome!  Thanks so much for the prompt reply.  I couldn't find anything addressing this type of functionality anywhere.
    Tuesday, May 8, 2007 1:52 PM