Home » Android » javascript – What is the view port width, height and device pixel ratio for the devices Google Pixel and Google Pixel XL

javascript – What is the view port width, height and device pixel ratio for the devices Google Pixel and Google Pixel XL

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am developing a web site and want see how it works on Google Pixel and Google Pixel XL devices. As I don’t have the access to those devices, I need to know the view port width, height and device-pixel-ratio of those devices.

I have tried searching on Google but still couldn’t find anything useful. Latest Chrome also doesn’t list those devices’ sizes in developer tools.

It will be really helpful if anyone have the access to these devices can figure the required information out.

How to&Answers:

Both the Pixel and Pixel XL are listed to have a css pixel resolution of 411×731, with device-pixel-ratios of 2.6 and 3.5 respectively.

Source: https://material.io/devices/ which is a Google site.

That’s odd though, considering most phones get more effective pixels as the screen size increases, rather than just blowing everything up bigger and getting a higher dppx (Dots Per Pixel).

That does jive with Lord Flash’s screen capture from the smaller Pixel; but doesn’t help to validate the Pixel XL. If someone could post a screen capture from the Pixel XL I could determine the scaling from that.

Answer:

The normal Pixel has a Resolution of 1080 x 1920 pixels (~441 ppi pixel density)

The Pixel XL has a resolution of: 1440 x 2560 pixels

Here is also a screenshot of the normal one. Feel free to measure whatever aspect you want:

Google Pixel Screenshot

Answer:

do you have the google pixel in hand?

load the page with JS code

var viewport = {
    width  : $(window).width(),
    height : $(window).height()
};


alert(viewport.height);
alert(viewport.width);