Search code examples
iphoneiossafarimobile-safariios7

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


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.


Solution

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