window.innerWidth in Chrome's device mode

后端 未结 4 2039
野的像风
野的像风 2021-01-08 00:29

When in google chrome\'s device mode, what does window.innerWidth return? Is it the viewport of the device (plus any scroll bars)?

I\'m getting different values for

4条回答
  •  伪装坚强ぢ
    2021-01-08 00:44

    I'm not sure if this is a recent update (since the last responses), but I was able to find the viewport height/width by using:

    window.screen.width
    

    and

    window.screen.height
    

    This was particularly useful when I was trying to test whether the screen was phone-sized or not.

提交回复
热议问题