bernk
bernk

Reputation: 1165

Is it possible to get the height of visible content between the address bar and keyboard in iOS Safari?

Height of visible HTML between address bar and field navigation / keyboard

Since the height of this area varies from device to device and iOS version, I'm wondering if there is any way to dynamically figure out its height to make this area more useful.

Upvotes: 1

Views: 3151

Answers (4)

notme__
notme__

Reputation: 11

It's possible to get the height of visible content now with the VisualViewport api (window.visualViewport.height). Seems it's only supported by safari 13 and higher though

Upvotes: 0

Imamudin Naseem
Imamudin Naseem

Reputation: 1702

It is not possible since safari 10.0

Upvotes: 1

Marc
Marc

Reputation: 3652

use this:

<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height" /> 

and then the correct value can be get from window.innerWidth / window.innerHeight

Upvotes: 1

JackW
JackW

Reputation: 999

I would imaging that $(window).height() would give you that data because it returns the height of the viewport, unless safari is being very weird/not doing as it should.

Upvotes: 0

Related Questions