Hi there,
I've been testing the framework and I can successfully get values from GetScreenSize(userAgent), but GetScreenDimensions() always gives me 0x0
e.g. http://feniksdev-staging.azurewebsites.net/m/News/heyadamhey/~/12794542/11419166
the above url is using the following in the master page's OnInit event:
in the Page's code behind :
in the aspx:
whether I load the above URL on my pc or phone, I get
"screen is 0x0"
I got the same result when following the examples here: http://www.telerik.com/help/aspnet-ajax/detection-framework.html
Thanks
Adam
I've been testing the framework and I can successfully get values from GetScreenSize(userAgent), but GetScreenDimensions() always gives me 0x0
e.g. http://feniksdev-staging.azurewebsites.net/m/News/heyadamhey/~/12794542/11419166
the above url is using the following in the master page's OnInit event:
public
DeviceScreenDimensions screenDimensions;
protected
override
void
OnInit(EventArgs e)
{
screenDimensions = Detector.GetScreenDimensions(Request.UserAgent);
}
in the Page's code behind :
protected
void
Page_Load(
object
sender, EventArgs e)
{
var master = (
this
.Page.Master
as
Mobi);
ScreenWidth = master.screenDimensions.Width;
ScreenHeight = master.screenDimensions.Height;
NewsContentFrame.Src = article.URL;
NewsContentFrame.Attributes.Add(
"height"
, ScreenHeight-10 +
"px"
);
NewsContentFrame.Attributes.Add(
"width"
, ScreenWidth-100 +
"px"
);
}
in the aspx:
<
p
>screen is <%= ScreenWidth%>x<%= ScreenHeight%></
p
>
<
iframe
runat
=
"server"
id
=
"NewsContentFrame"
></
iframe
>
whether I load the above URL on my pc or phone, I get
"screen is 0x0"
I got the same result when following the examples here: http://www.telerik.com/help/aspnet-ajax/detection-framework.html
Thanks
Adam
6 Answers, 1 is accepted
0
Hi Adam,
Unfortunately, I am not able to open the provided URL - I am sent to the site's home page instead.
The RadDeviceDetectionFramework 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 small screen devices as well as to allow you to apply different CSS for different predefined or custom ranges of mobile devices' screen size. Desktop screens size is not covered by this tool as those screens are big enough to allow work with the controls' default Classic render mode.
This framework matches the user agent string from the request with a predefined database that holds records for various mobile devices screen size in CSS pixels. That screen size check should be done server-side to allow proper control rendering - client-side check would come too late. When the framework finds a match, it returns the screen size. If no match is found, the result returned is 0. In the case of mobile devices there is specific screen size for each device that is known in advance and could be matched against unique user agent string values that hold information about the mobile device model.
Having in mind desktop browsers, however, there is no fixed screen size that could be matched against a certain user agent string value. This string would be one and the same for a 13 inch screen and a 19 inch screen used with one and the same version of a desktop browser. For that reason the only certain information about desktop browsers is that they are in the ExtraLarge range. As dimensions cannot be determined on the server, they are returned as 0.
Although the RadDeviceDetectionFramework database covers a wide range of mobile devices, it is extremely difficult to cover all devices models available on the market. Our database is constantly growing and the primary goal is to encompass the most widely used mobile devices. The most probable reason why you receive 0 x 0 on your phone is that its model is not covered in the current RadDeviceDetectionFramework database. We plan to update it in our next release and provide better device coverage.
I have attached a sample page that displays the detected results. You may test it and your page with the Google Chrome device emulator and check if it returns different screen dimensions. Note that after selecting a device to emulate, you should refresh the page to emulate the selected device.
Regards,
Dimitar
Telerik
Unfortunately, I am not able to open the provided URL - I am sent to the site's home page instead.
The RadDeviceDetectionFramework 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 small screen devices as well as to allow you to apply different CSS for different predefined or custom ranges of mobile devices' screen size. Desktop screens size is not covered by this tool as those screens are big enough to allow work with the controls' default Classic render mode.
This framework matches the user agent string from the request with a predefined database that holds records for various mobile devices screen size in CSS pixels. That screen size check should be done server-side to allow proper control rendering - client-side check would come too late. When the framework finds a match, it returns the screen size. If no match is found, the result returned is 0. In the case of mobile devices there is specific screen size for each device that is known in advance and could be matched against unique user agent string values that hold information about the mobile device model.
Having in mind desktop browsers, however, there is no fixed screen size that could be matched against a certain user agent string value. This string would be one and the same for a 13 inch screen and a 19 inch screen used with one and the same version of a desktop browser. For that reason the only certain information about desktop browsers is that they are in the ExtraLarge range. As dimensions cannot be determined on the server, they are returned as 0.
Although the RadDeviceDetectionFramework database covers a wide range of mobile devices, it is extremely difficult to cover all devices models available on the market. Our database is constantly growing and the primary goal is to encompass the most widely used mobile devices. The most probable reason why you receive 0 x 0 on your phone is that its model is not covered in the current RadDeviceDetectionFramework database. We plan to update it in our next release and provide better device coverage.
I have attached a sample page that displays the detected results. You may test it and your page with the Google Chrome device emulator and check if it returns different screen dimensions. Note that after selecting a device to emulate, you should refresh the page to emulate the selected device.
Regards,
Dimitar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Adam
Top achievements
Rank 1
answered on 09 Sep 2014, 10:18 AM
Hi Dimitar,
thanks for the feedback.Here is a working link you can test my page on:
http://feniksdev-staging.azurewebsites.net/m/News/heyadamhey/~/16402658/7421
I understand that testing with desktop user agent will give 0x0, but I still consistently get 0x0 when using my Sony Z1 device.
I have noticed that SOME devices do show viewport dimensions, but some do not. see attached screenshots
thanks for the feedback.Here is a working link you can test my page on:
http://feniksdev-staging.azurewebsites.net/m/News/heyadamhey/~/16402658/7421
I understand that testing with desktop user agent will give 0x0, but I still consistently get 0x0 when using my Sony Z1 device.
I have noticed that SOME devices do show viewport dimensions, but some do not. see attached screenshots
0
Accepted
Hi Adam,
I have tested the link provided and I can confirm that for some devices, the results returned are 0x0.
I would like to clarify that this behavior is expected as noted in the RadDeviceDetectionFramework documentation:
"GetScreenDimensions(string userAgent) - Returns the screens dimensions of the device made request in CSS pixels. If there is no match the dimensions will be 0. "
The RadDeviceDetectionFramework database update for the Telerik UI for ASP.NET AJAX Q3 2013 release will provide about 20 000 user agent string combinations, which would improve the Screen Dimensions results returned.
Regards,
Dimitar
Telerik
I have tested the link provided and I can confirm that for some devices, the results returned are 0x0.
I would like to clarify that this behavior is expected as noted in the RadDeviceDetectionFramework documentation:
"GetScreenDimensions(string userAgent) - Returns the screens dimensions of the device made request in CSS pixels. If there is no match the dimensions will be 0. "
The RadDeviceDetectionFramework database update for the Telerik UI for ASP.NET AJAX Q3 2013 release will provide about 20 000 user agent string combinations, which would improve the Screen Dimensions results returned.
Regards,
Dimitar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Adam
Top achievements
Rank 1
answered on 09 Sep 2014, 01:32 PM
Hi Dimitar,
Thanks for the feedback. I assume you mean the Q3 2014 release?
Any idea when we could expect that?
Thanks
Adam
Thanks for the feedback. I assume you mean the Q3 2014 release?
Any idea when we could expect that?
Thanks
Adam
0
Adam
Top achievements
Rank 1
answered on 09 Sep 2014, 01:36 PM
Sorry - I also meant to ask if the list of devices is packaged in the Telerik DLL, or if the library makes an API call each time. i.e. would we need to update the DLL in order to receive an updated list of devices?
Thanks again
Adam
Thanks again
Adam
0
Accepted
Hi Adam,
Yes, I mean the Q3 2014 release. It is expected around the end of October or the beginning of November. In order to receive the updated list of devices detected, you would need to update the Telerik.Web.Device.Detection.dll.
Regards,
Dimitar
Telerik
Yes, I mean the Q3 2014 release. It is expected around the end of October or the beginning of November. In order to receive the updated list of devices detected, you would need to update the Telerik.Web.Device.Detection.dll.
Regards,
Dimitar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.