Skip to content

Instantly share code, notes, and snippets.

@tonygentilcore
Last active November 3, 2016 15:10
Show Gist options
  • Save tonygentilcore/fe58b0b31a941b791b554d223a045188 to your computer and use it in GitHub Desktop.
Save tonygentilcore/fe58b0b31a941b791b554d223a045188 to your computer and use it in GitHub Desktop.
Viewport measurement test
<!DOCTYPE html>
<html>
<head>
<title>Viewport measurement test</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
</head>
<body>
<div>
<br />
In Mobile Safari, tap the text box to open the keyboard. The test succeeds
if the visible viewport (sans keyboard) is reported.
<br /><br />
<input type="text" />
<div id="log"></div>
</div>
<script>
function log(msg) {
document.getElementById('log').innerHTML += `${msg}<br>`
}
addEventListener('focus', () => log(`focus height: ${window.innerHeight}`), true)
addEventListener('load', () => log(`initial height: ${window.innerHeight}`))
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment