简体   繁体   English

尽管高清分辨率高,为什么屏幕分辨率与智能手机上的javascript屏幕宽度不同?

[英]Why does screen resolution differ from javascript screen width on smartphone eventhough high hd resolution

var winsize = "Window size " + screen.width; var winsize =“窗口大小” + screen.width;

It would say 860 pixels when my phone resolution is 1440 x 2560 pixels even if browser is taking the whole screen rotated or not 当我的手机分辨率为1440 x 2560像素时,即使浏览器不旋转整个屏幕,也可以说860像素

Mobile devices have viewport scaling. 移动设备具有视口缩放比例。 They display pages in virtual pixel dimensions so that pages which use pixel values for sizing will still look reasonable on small displays. 它们以虚拟像素尺寸显示页面,因此使用像素值进行大小调整的页面在小型显示器上仍然看起来合理。

Mobile devices tend to have extremely high pixel densities and without this viewport scaling, most of the web would be unreadable and unusable. 移动设备往往具有极高的像素密度,并且如果没有这种视口缩放功能,则大多数Web将是不可读和不可用的。

There are other Stack Overflow questions if you want to know how to deal with this issue: 如果您想知道如何处理此问题,还有其他堆栈溢出问题:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM