Detecting tab using 51Degrees.mobi Foundation - asp.net-mvc-3

I am trying out to detect the Ipad or Samsung Galaxy Tab or any other Tab using 51Degrees.mobi Foundation library.
I am using Request.Browser["is_tablet"] but it is returning me false. Is there any one who knows if this is the known issue or I am making some mistake.
I am testing this using Opera Mobile Emulator
can you give me URL to download the simulator for iPad?
I am describing again my issue below--
I am using 51Degrees.mobi Foundation in my MVC application. When I use Request.Browser["is_tablet"] in my View Engine to check if request is from tab, its giving me false as a result. This is happening for Samsung Galaxy Tab(Opera Mobile Emulator) and Ipad (AIRiPad emulator).
In this case the Request.Browser.IsMobileDevice and Request.Browser["is_wireless_device"] is also returning false. Hence the regular MVC views designed for desktop is getting loaded.
I am not using Locations in config file as I need to redirect to appropriate views from my view engine when request is from mobile or tablet.
Let me know is there any knows issue with is_tablet or Am I doing it wrong way or is there issue with emulator?

If you are using the open source lite device data, then you won't be able to detect the tablet capability. You can however detect both whether the device is mobile (IsMobile (boolean)) and the screen size (ScreenPixelsHeight (int) and ScreenPixelsWidth (int)). You may be able to determine whether or not the device is a tablet by using a combination of these values.
You can check the avaliable properties using the property dictionary here. Hope this helps.

Request.Browser["is_tablet"] works fine for me:
used the iPad simulator from Blackbaud labs.
http://labs.blackbaud.com/NetCommunity/article?artid=662
User-Agent:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10
Check your logfile App_Data/Log.txt for this entry:
Info - Loaded 14691 devices using 12720 strings in 2295ms
set the log level to debug in your config file
< log logFile="~/App_Data/Log.txt" logLevel="Debug"/>

Related

User-Agent information does not helps to identify if request comes from iPAD or MAC OS in Safari Browser

I am trying to know if the rest API request is coming from the iPad / mac OS of the safari browser. But, USER-AGENT header information remains the same for iPad & mac from safari browser.
Looking forward to knowing the answer if anyone found the solution.
If you query - "navigator.appVersion" it gives the same value for Mac and IPAD for Safari browser. But you can use an alternate property like - "navigator.maxTouchPoints" which gives a value of 5 on IPAD and 0 on mac. This can be used to differentiate the user agent rather than picking it up from the request header.

why is the user agent string got changed?

I'm having a problem debugging my application. In my app I need to decide if a user is on a mobile device or not base on the user agent string.
From the log info, at the beginning I saw the user agent is "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1", which should be Safari 11 on iOS 11. Then several minutes later the user agent info changed to "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15", which should be Safari 11.1 on macOS (High Sierra). From tealeaf I saw the user didn't change browser or device.
So my questions are:
Is it possible for the user agent string changing without changing browser and device? When?
For my case, why it happens?
What's the most robust way to decide if a user is on mobile/tablet or desktop?
thanks.
YES. It it entirely possible to manipulate the user agent string without changing browser or device. It's possible (and quite trivial) to spoof it entirely, such as with User Agent Switcher for Chrome. Having said that, the vast majority of users won't go to the extent of spoofing it.
Considering the User Agent strings thinks the browser is the same, but not the Operating System... I would assume that the user has turned on the Device Toolbar and enabled Responsive Mode in the F12 Developer Tools. This allows you to simulate the display of a website in a different aspect ratio, and does indeed manipulate the User Agent string when you select one of the available devices.
It depends on what exactly you're trying to do. If you're looking for different logic based on device, I would recommend a regex. There's some great examples for different programming languages at DetectMobileBrowsers. If you're looking for a different display however, I would recommend media queries. You can cater for the width, pixel ratio and even orientation of a device. There's a great list of common queries at CSS Tricks.

i want to view something in the internet, how can i do it?

i want to view something in the internet, how can i do it?
Thanks
If all else fails, route your WLAN over a box on which you install a network sniffer. Dump the HTTP traffic. That's the last resort solution, but for sure works.
Generally user agent sniffing is the only method used to detect iPhones. You can use the develop menu in Safari to change your user agent string. An example iPhone user agent string is
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5
Alternatively, you can add a bookmarklet by Shaun Inman to Mobile Safari that allows you to view source code on your device (or just visit the page directly).

Bring back mobile version of website in WebBrowser control for wp7?

Is it possible to bring back web pages in a mobile format, if available, before showing the normal rendering of a web page? I noticed I was getting both when I used it. Or is this enabled by default?
EDIT: For example in ie on the phone you can request to recieve webpages in a mobile version or desktop version. Is this option available to developers and if not what is the default for the control?
Sadly, there's no API for toggling this setting - and no easy way to intercept the outgoing HTTP calls from the browser control.
Looking at some output from the emulator it looks like the mobile/full setting toggles this in the User-Agent:
Mobile -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
Desktop -
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+XBLWP7;+ZuneWP7)
Here also are some mobile agents captured "in the wild" - http://www.elucidsoft.com/blog/2010/11/19/windows-phone-7-user-agents/
It looks like this settings is a global setting for the OS - so whatever the user chooses in the browser settings is also used in your app (I think this is what I just saw).
I had this problem for a very, very long time and I finally figured it out with the following:
string header =
"User-Agent:Mozilla/5.0 (iPhone; U;
CPU iPhone OS 4_1 like Mac OS X;
en-us) AppleWebKit/532.9 (KHTML, like
Gecko) Version/4.0.5 Mobile/8B117
Safari/6531.22.7";
MyWebBrowser.Navigate(new
Uri("http://www.google.com"), null,
header);
The following header DID NOT work for me (on the gmail website):
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+Phone+OS+7.0;+Trident/3.1;+IEMobile/7.0;+Microsoft;+XDeviceEmulator)
The WebBrowser control does not expose an API that enables you to choose between the Desktop or the Mobile version of a web page. You could use Fiddler to trap the traffic for outgoing requests (from the emulator or a device) to see if there's anything in particular about the request that you might be able to replicate in yoru own requests.

How can I get the actual culture name from an iPhone web app?

CLARIFIED: This is a JavaScript Web Application not a Native Object-C application.
I have a web application running on the iPhone that I need to globalize.
I've configured Settings->General->International->Region Format to "United Kingdon" and left Language as "English".
Upon inspection of the User Agent string I'm seeing the following:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/8A293
I would expect to en-GB but I'm seeing en-us.
I've even tried restarting the iPhone and it remains en-us.
From what I understand, the language portion comes from set type of your iPhone's "Language" (e.g. menus and buttons in the user interface) and not the Region Format.
source
I believe you should use NSUserDefaults to get that information
ChoosingLocalizations
It would appear as if the iPhone browser does not look at the region being set by the settings on the device.
The user agent and navigator.language both return en-US and disregard any changes to the region by the user.

Resources