How to detect if user is on a mobile device browser?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TimSki
    New Member
    • Jan 2008
    • 83

    How to detect if user is on a mobile device browser?

    Hi,

    Is there an easy way in CLASSICasp to see if a user is accessing a page via a mobile device.

    Thanks in advance
  • Ankit1027
    New Member
    • Aug 2010
    • 4

    #2
    Yes...it is the property of the browser to recognize the CSS file related to the Web Page.

    You need to upload the CSS file related to web page on the server. As the browser will open the webpage, it will recognize and the respective CSS will be loaded

    -Ankit

    Comment

    • TimSki
      New Member
      • Jan 2008
      • 83

      #3
      ok thanks, but i don't really understand. i thought that some mobile devices didn't support css ?

      Comment

      • Ankit1027
        New Member
        • Aug 2010
        • 4

        #4
        When you are saying mobile phones, you mean Smart Phones (iPhone, Blackberry, Symbain OS, Droid OS, and Windows OS)

        Comment

        • TimSki
          New Member
          • Jan 2008
          • 83

          #5
          yes exactly

          Comment

          • TimSki
            New Member
            • Jan 2008
            • 83

            #6
            is it possible to make use of Request.ServerV ariables(HTTP_U SER_AGENT) to detect the browser type and then make decisions on that ?

            Comment

            • jhardman
              Recognized Expert Specialist
              • Jan 2007
              • 3405

              #7
              yes, exactly.
              Code:
              if instr(request.serverVariables("HTTP_USER_AGENT"), "PalmOS") > 0 then
                 response.redirect "mypage_mobile.asp"
              end if
              Pretty simple stuff.

              Jared
              Last edited by jhardman; Aug 26 '10, 01:49 PM. Reason: typo

              Comment

              • Ankit1027
                New Member
                • Aug 2010
                • 4

                #8
                TimSki

                Mobile Customized do support CSS.

                Try this, if you are working on .NET

                <script runat="server" language="c#">

                public void Page_Load(Objec t sender, EventArgs e)
                {
                if (Request.Browse r["IsMobileDevice "] == "true" )
                {
                Response.Redire ct("MobileDefau lt.aspx");
                }
                else
                {
                Response.Redire ct("DesktopDefa ult.aspx");
                }
                }


                I have developed a Smartphone Customized Website and we have used CSS files to show up.

                -Ankit

                Comment

                Working...