Last active
November 3, 2016 15:10
-
-
Save tonygentilcore/fe58b0b31a941b791b554d223a045188 to your computer and use it in GitHub Desktop.
Viewport measurement test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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