when i access it on my device i am getting the output like(using Internet Explorer):
User Agent :PPC; 240x320; HTC_P3450/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) Browser Type : Mozilla MajorVersion
: 4 MinorVersion : 0 Platform : WinCE Browser : Mozilla Version : 4.0 IsBeta ? : False Is Crawler ? : False Is AOL ? : False Is Win16 ? : False Is Win32 ? : False Supt Frames ? : False Supt Tables ? : False Supt Cookies ?: False Supt VBs ? : False Supt
AX Ctrls?: False ScreenHeight : 320 Screen Width : 240 DeviceManufacturer :Unknown DeviceModel : Unknown IP Address : xx.xx.xx.xx
but when i try to access it dfrom my emulator, out put is
(using Internet Explorer):
User Agent :Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12) Browser Type : Mozilla MajorVersion : 6 MinorVersion : 0 Platform : WinCE
Browser : WinCE Version : 6.0 IsBeta ? : False Is Crawler ? : False Is AOL ? : False Is Win16 ? : False Is Win32 ? : False Supt Frames ? : True Supt Tables ? : True Supt Cookies ?: True Supt VBs ? : False Supt AX Ctrls?: True ScreenHeight : 72 Screen Width
: 96 DeviceManufacturer :Unknown DeviceModel : Unknown IP Address : xx.xx.xx.xx
Opera and Mozilla's Browser goves me correct details.
one more thing i would like to know is that: how can i debug mobile web application in VS 2005 Environment, do u guys have any link or any tutorials available for that...
You can also use 51degrees.mobi Foundation API which detects all mobile devices. It is a .NET open source available here
http://51degrees.codeplex.com/releases.
It easily detects if the request is coming from any mobile device and redirects user to mobile landing page. It has user friendly samples to try this out.
nimeshprabha...
Participant
1898 Points
525 Posts
HOW to detect mobile web browser ?
Nov 07, 2008 07:00 AM|LINK
Hi all,
i am using Wan HTC Touch with windows 6.0 OS.
my aim is to find the IPAddress of the mobile, Browser detection and device detection.
using the code below i managed to display some details. i hosted this in my localmachines IIS
protected void Page_Load(object sender, EventArgs e) { string ip=string.Empty; 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")) { ip = Request.ServerVariables["REMOTE_ADDR"]; } MobileCapabilities cap = (MobileCapabilities)Request.Browser; string agent = Request.UserAgent.ToString(); string def = "User Agent :"+agent+"\nBrowser Type : " + cap.Type + "\n" + "MajorVersion : " + cap.MajorVersion + "\n" + "MinorVersion : " + cap.MinorVersion + "\n" + "Platform : " + cap.Platform + "\n" + "Browser : " + cap.Browser + "\n" + "Version : " + cap.Version + "\n" + "IsBeta ? : " + cap.Beta + "\n" + "Is Crawler ? : " + cap.Crawler + "\n" + "Is AOL ? : " + cap.AOL + "\n" + "Is Win16 ? : " + cap.Win16 + "\n" + "Is Win32 ? : " + cap.Win32 + "\n" + "Supt Frames ? : " + cap.Frames + "\n" + "Supt Tables ? : " + cap.Tables + "\n" + "Supt Cookies ?: " + cap.Cookies + "\n" + "Supt VBs ? : " + cap.VBScript + "\n" //+ "Supt Js ? : " + cap.JavaScript + "\n" + "Supt AX Ctrls?: " + cap.ActiveXControls + "\n" + "ScreenHeight : " + cap.ScreenPixelsHeight.ToString() + "\n" + "Screen Width : " + cap.ScreenPixelsWidth.ToString() + "\n" + "DeviceManufacturer :" + cap.MobileDeviceManufacturer + "\n" + "DeviceModel : " + cap.MobileDeviceModel + "\n" + "IP Address : " + ip + "\n"; Label2.Text = def; }when i access it on my device i am getting the output like(using Internet Explorer):
User Agent :PPC; 240x320; HTC_P3450/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) Browser Type : Mozilla MajorVersion : 4 MinorVersion : 0 Platform : WinCE Browser : Mozilla Version : 4.0 IsBeta ? : False Is Crawler ? : False Is AOL ? : False Is Win16 ? : False Is Win32 ? : False Supt Frames ? : False Supt Tables ? : False Supt Cookies ?: False Supt VBs ? : False Supt AX Ctrls?: False ScreenHeight : 320 Screen Width : 240 DeviceManufacturer :Unknown DeviceModel : Unknown IP Address : xx.xx.xx.xx
but when i try to access it dfrom my emulator, out put is (using Internet Explorer):
User Agent :Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12) Browser Type : Mozilla MajorVersion : 6 MinorVersion : 0 Platform : WinCE Browser : WinCE Version : 6.0 IsBeta ? : False Is Crawler ? : False Is AOL ? : False Is Win16 ? : False Is Win32 ? : False Supt Frames ? : True Supt Tables ? : True Supt Cookies ?: True Supt VBs ? : False Supt AX Ctrls?: True ScreenHeight : 72 Screen Width : 96 DeviceManufacturer :Unknown DeviceModel : Unknown IP Address : xx.xx.xx.xx
Opera and Mozilla's Browser goves me correct details.
one more thing i would like to know is that: how can i debug mobile web application in VS 2005 Environment, do u guys have any link or any tutorials available for that...
Nimesh Prabhakar
Mark this post as "ANSWER", if it helped you..
SKT_01
Participant
1930 Points
435 Posts
Re: HOW to detect mobile web browser ?
Nov 07, 2008 11:02 AM|LINK
Hello,
the user agents of the images which you use in Microsoft Devivice Emulator are different from those of real devices like your HTC.
For debugging you can try to attach the debugger to the emulator process with "Attach to process" on the Debug menu.
sanketce
Participant
956 Points
195 Posts
Re: HOW to detect mobile web browser ?
Nov 07, 2008 11:02 AM|LINK
This may help you
http://blog.abwebsitedesign.com/2008/09/mobile-web-browser-detection-and.html
sameer_khanj...
Contributor
7060 Points
1378 Posts
Re: HOW to detect mobile web browser ?
Nov 08, 2008 08:28 AM|LINK
http://www.codeproject.com/KB/mobile/All-about-a-mobile-websit.aspx
http://worldofasp.net/tut/XHTM_L-MP/Basics_of_XHTML-MP_178.aspx
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.
davemanjra
Member
4 Points
2 Posts
Re: HOW to detect mobile web browser ?
Nov 16, 2008 10:52 PM|LINK
amar_j
Member
76 Points
55 Posts
Re: HOW to detect mobile web browser ?
Aug 09, 2010 05:32 AM|LINK
You can also use 51degrees.mobi Foundation API which detects all mobile devices. It is a .NET open source available here http://51degrees.codeplex.com/releases.
It easily detects if the request is coming from any mobile device and redirects user to mobile landing page. It has user friendly samples to try this out.
Thanks
Amaresh