Results 1 to 4 of 4

Thread: .Net Detect Smartphone

  1. #1
    Join Date
    Mar 2009
    Posts
    37

    .Net Detect Smartphone

    Detect Smart Phone or PDA version in a Web Page

    I wanted to know weather the device is a smart phone or PDA while connecting to Web Page." Can anyone help with this....??

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: .Net Detect Smartphone

    Try this Hope this Helps :

    Code:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not IsPostBack Then
                Dim Browser_obj As System.Web.Mobile.MobileCapabilities = CType(Request.Browser, System.Web.Mobile.MobileCapabilities)
                If Browser_obj.Browser = "Pocket IE" Then
                    Label1.Text = " is a Pocket PC"
                ElseIf Browser_obj.Browser = "IE" Then
                    Label1.Text = "Internet Explorer"
                ElseIf Browser_obj.Browser = "Phone.com" Then
                    Label1.Text = "is a Openwave"
                End If
            End If
        End Sub

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: .Net Detect Smartphone

    Excluding Unknown Browsers

    If you provide only evidence for specific browsers in the detection logic, your site will not be usable if a visitor uses a different browser. Consider the following example:

    Code:
    // WRONG Application - not to use!
    if (document.all)
    {
    // Internet Explorer
    document.write('<link rel="stylesheet" type="text/css" src="style-ie.css">');
    }
    else if (document.layers)
    {
    document.write('<link rel="stylesheet" type="text/css" src="style-nn.css">');
    }
    Note like the precedence example of style only for Internet Explorer and Navigator 4 and also then only if the visitor has activated the support Javascript in own browser. The customers of Netscape 6, Netscape 7, CompuServe 7, Mozilla, Work will not be in a position to visualizing the site correctly.


    Unidentifying Browsers

    Authors of a general failure of the network will be formed to assume that when a browser is not Netscape Navigator 4, Internet Explorer, it should be and vice versa. For example:

    Code:
    // WRONG Application - not to use!
    if (document.all)
    {
      // Internet Explorer
      elm = document.all['menu'];
    }
    else
    {
      // Assume Navigator 4
      elm = document.layers['menu'];
    }
    Mark on how the above example assumed that each use browser which Internet Explorer is not navigator 4 and tried layers.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: .Net Detect Smartphone

    Try it will work Definitely :

    Code:
    if (Request.Headers["User-Agent"] != null &&
    (Request.Browser["IsMobileDevice"] == "true" 
    || Request.Browser["BlackBerry"] == "true" ||
    Request.UserAgent.ToUpper().Contains("MIDP")
    || Request.UserAgent.ToUpper().Contains("CLDC"))
    || Request.UserAgent.ToLower().Contains("iphone"))

Similar Threads

  1. HTC One X smartphone
    By Miyamoto in forum Reviews
    Replies: 1
    Last Post: 08-04-2012, 06:52 PM
  2. Need a New Smartphone with HD
    By EveryWer in forum Portable Devices
    Replies: 6
    Last Post: 23-11-2011, 08:44 AM
  3. What smartphone will be best for me?
    By Dum in forum Portable Devices
    Replies: 6
    Last Post: 02-05-2011, 07:11 AM
  4. HTC 7 Pro Smartphone
    By OptimuS PrimE in forum Reviews
    Replies: 2
    Last Post: 11-02-2011, 07:46 PM
  5. Smartphone vs PDA
    By Kaddy in forum Portable Devices
    Replies: 3
    Last Post: 26-08-2009, 09:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,629,675.16024 seconds with 17 queries