I've tried all the answers for this similar question to calculate the correct content height of a WKWebView, but the result height is always beyond the actual height that makes a long empty area below the end of the content.
Ways I tried:
webView.eveluateJavaScript()
webView.scrollView.contentSize
WKScriptMessageHandler (get the message.body.valueForKey("body"))
And here's the HTML string I tried to load:
> <html><head><style>img{max-width:100%%;height:auto
> !important;width:auto !important;};</style></head><body
> style='margin:0; padding:0; font-size:[myFontSize];
> font-family:[myFont]; color:[myColor]'>[myHTMLstring]</body></html>
Is there another way to get the correct height of WKWebView?