Get total height of webView’s content using Javascript

There is no need to use Javascript in iOS 5.0 and up – you have direct, documented access to its scrollView:

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    CGFloat contentHeight = webView.scrollView.contentSize.height;
    // ....
}

To get the total height of the contents of the webView.

Leave a Comment