This is a migrated thread and some comments may be shown as answers.

Device Detection

1 Answer 422 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 08 Jun 2017, 02:46 AM

Hi Guys,

I have a site that is fixed width and fits perfectly on desktop and tablets.

I want the RadDeviceDeection Framework to discern if the device is a mobile phone and then redirect to a different set of web pages.(not responsive).

When testing on a desktop I get an output such as 

ScreenSize By Range : 3 : ScreenSize By UserAgent : 3
 
ScreenSize By Range TS : ExtraLarge : ScreenSize By UserAgent TS : ExtraLarge
 
Height : 0 Width : 0
 
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888

On a mobile phone, it detects the height & width and a small screen size.

The problem is,it also detects tablets with a small screen size - but no height & width.
No matter how small I make the custom range for screen size it always returns small for both mobile & tablet.

What would be the best way for me to detect a mobile phone only please?
I could do it if a height & width was found; but not sure if this would cover all.

Cheers,

Jon

 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Jun 2017, 02:40 PM

Hi,

RadDeviceDetectionFramework uses the browser user agent string to match against a predefined database on the server and decide whether the device used is mobile or not. It is designed to distinguish whether your application is browsed on a desktop screen or on a mobile device screen. Its purpose is to allow automatic enabling of controls' Mobile render mode when browsed under mobile devices as well as to allow you to apply different CSS for different predefined or custom ranges of mobile devices' screen size.

Have you tried to distinguish the device type based on its browser agent string? 

For your convenience I have found the following useful resources:

https://stackoverflow.com/questions/27635020/how-can-i-determine-whether-the-device-is-a-phone-or-tablet-using-the-unity-engi

https://forums.asp.net/t/1767942.aspx?Detect+Mobile+and+Tablet+devices

http://detectmobilebrowsers.com/ 

Regards,
Rumen
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or