简体   繁体   中英

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

var winsize = "Window size " + 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

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.

There are other Stack Overflow questions if you want to know how to deal with this issue:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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