Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate height of viewable area (i.e., window height minus address & bookmark bars) in mobile Safari for web app?

Tags:

What is the right way to calculate how much viewable space is available on mobile Safari? By viewing area, we mean the amount of the screen actually available to a web app, that is the window height minus the address and bookmark bars.

iOS 7 prevents hiding of the address bar, and we need to properly account for the viewport height.

like image 249
Crashalot Avatar asked Sep 26 '13 22:09

Crashalot


People also ask

How do you find the height of a viewport?

You can use the window. innerHeight property to get the viewport height, and the window. innerWidth to get its width. let viewportHeight = window.

How do I make my window visible height?

$(window). height() gives you the height of the view pane. $(window). height() works better as it's cross-browser.


1 Answers

window.innerWidth and window.innerHeight will give the width and height of the viewport.

like image 59
neilco Avatar answered Nov 15 '22 12:11

neilco