I have an app that is loaded inside an iframe. The code looks something like this (sample):
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
</head>
<body>
<iframe src="app_url_on_a_different_domain" height=100% width=100%>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
</head>
<body>...</body>
</html>
</iframe>
</body>
</html>
I am trying to get the viewport height from inside the iframe by doing the following (the iframe src is a different domain so I cannot access the parent container):
document.documentElement.clientHeight
This gives me the correct viewport on desktop browsers; however, on mobile safari/chrome, instead of getting the actual device height, I get the height of all the content inside the iframe. So instead of "460" on a iPhone 5, I get something like "3000".
How can I get the available viewport from inside this iframe?