apprentice
apprentice

Reputation: 931

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

Upvotes: 1

Views: 126

Answers (1)

Brad
Brad

Reputation: 163232

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:

Upvotes: 1

Related Questions