Why is window.innerWidth much larger than window.screen.width on my Android device?

  Kiến thức lập trình

My javascript code is

var txt = "Screen: " + window.screen.width + " x " + window.screen.height + " px";
txt += "<br/>Window: " + window.innerWidth + " x " + window.innerHeight + " px";

my laptop shows

Screen: 1920 x 1080 px
Window: 1920 x 929 px

but on mobile with chrome browser I get:

Screen: 412 x 869 px
Window: 980 x 1717 px    

while the device has 3040×1440 pixel (Samsung Galaxy S10) and I did not zoom the window !

and Firefox (on the same mobile) shows:

Screen: 360 x 720 px
Window: 865 x 1517 px

I expect that screen.width >= window.innerWidth on mobiles too.

LEAVE A COMMENT