• About Us
  • Blog
  • Basket
  • Account
  • Sign In


PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Feb 2020 02:43 PM by  AliHost
ScreenPixelsWidth on desktop browser
 1 Replies
You are not authorized to post a reply.
Author Messages


New Member

New Member

14 Feb 2020 04:38 PM
    Just wondering if I could get some help. I was trying to use ScreenPixelsWidth however on desktop it always returns 0.

    var deviceWidth = Request.Browser.ScreenPixelsWidth;

    Just wondering can you recommend any way to retrieve the screen pixels width across all devices and browsers.
    I am using the lite edition.
    Appreciate any help you can give.
    Kindest Regards


    New Member

    New Member

    18 Feb 2020 02:43 PM
    Hi Lori,

    ScreenPixelsHeight & ScreenPixelsWidth should be used when IsMobile = True, as this indicates the device making the request is either a smartphone or tablet. We have these values populated against the devices in our database and the property value will return an integer value.

    Desktop User-Agents are different to those from smartphones or tablets as they do not contain a model identifier (only OS & Browser) in the User-Agent to distinguish between desktop computer models or whether it is an emulator. Here is a standard desktop request from my PC - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

    In these instances you should instead use ScreenPixelsHeightJavaScript & ScreenPixelsWidthJavaScript properties to pull the information from the browser being used. These properties are available to you in the Lite datafile.

    If you have any other queries you can contact support@51degrees.com directly.

    Best Regards,

    Alistair H
    You are not authorized to post a reply.