WKWebViewTips
WKWebViewTips copied to clipboard
Height
hi:
How to get the WKWebview's realHeight after finishLoad?? please help...
The following code must do the job:
[webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error) {
NSNumber *scrollHeight = result;
}];
I have a question,i put the WKWebView in the UITableView's Cell, I hope the cell can the same height with webView, so,they can scroll together.so i by [webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error) { NSNumber *scrollHeight = result; }]; get the webview's real height , and make the cell the same height with webView, but the webView can not show complete,,I do not the reason,,,,please help me
I use webView.scrollView.contentSize.height instead of the JavaScript code.
Actually webView.scrollView.contentSize.height work not well below iOS9. Especially this page still don't finish load. In this case, you get a wrong result.
After webview finish load page, you maybe get a another wrong result when user touch the page.
@ShingoFukuyama