For B4i:
If you are using LoadHtml then add this following code before your html text
For B4A:
Dependency: WebViewExtras2 (v2.20)
Run this JavaScript code after the page is loaded:
Sub webview_PageFinished (Success As Boolean, Url As String)
wait for (webview.EvaluateJavaScript("document.documentElement.scrollHeight")) webview_JSComplete (Success As Boolean, Result As String)
If Success Then webview.Height = DipToCurrent(Result)
End Sub
HTML:
<head><meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'/></head>
For B4A:
Dependency: WebViewExtras2 (v2.20)
Add WebViewExtra and DefaultJavascriptInterface variable in Global Sub:
Sub Globals
Dim wve As WebViewExtras
Dim jsi As DefaultJavascriptInterface
End Sub
Initialize WebViewExtra and DefaultJavascriptInterface before loading content in WebView:
wve.Initialize(webview)
jsi.Initialize
wve.AddJavascriptInterface(jsi,"B4A")
Run this JavaScript code after the page is loaded:
Sub webview_PageFinished (Url As String)
wve.ExecuteJavascript("B4A.CallSub('SetWVHeight',true, document.documentElement.scrollHeight);")
End Sub
Sub SetWVHeight(height As String)
webview.Height = DipToCurrent(height)
End Sub
Last edited: