|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
.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
| |||
| |||
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
| |||
| |||
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">'); } 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']; } |
#4
| |||
| |||
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")) |
![]() |
|
Tags: detect, net, pda version, web page |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HTC One X smartphone | Miyamoto | Reviews | 1 | 08-04-2012 06:52 PM |
Need a New Smartphone with HD | EveryWer | Portable Devices | 6 | 23-11-2011 08:44 AM |
What smartphone will be best for me? | Dum | Portable Devices | 6 | 02-05-2011 07:11 AM |
HTC 7 Pro Smartphone | OptimuS PrimE | Reviews | 2 | 11-02-2011 07:46 PM |
Smartphone vs PDA | Kaddy | Portable Devices | 3 | 26-08-2009 09:53 AM |