UIWebView - get total height of contents using Javascript
- by Emil
Hey.
I'm trying to use a UIWebView for displaying content higher than the screen of the iPhone, without needing to scroll in the webView itself.
For that, I need a way to get the total document size, including the scrollable area.
I have tried a number of different Javascript solutions:
(document.height !== undefined) ? document.height : document.body.offsetHeight // Returns height of UIWebView
document.body.offsetHeight // Returns zero
document.body.clientHeight // Returns zero
document.documentElement.clientHeight // Returns height of UIWebView
window.innerHeight // Returns height of UIWebView -2
Can you think of any other way to do it? Thanks.