Hi friends, i have some trobles with WebViewExtras1 ver 2.20.
I have a web page login.html and jsfunction setHtml but when run this code:
setHtml is not starting.
Where i am wrong?
My javascript function is simple:
I have a web page login.html and jsfunction setHtml but when run this code:
B4X:
html = File.ReadString(File.DirAssets , "login.html")
html = html.Replace("__TC_APP_TITLE__","Time Controller")
WebView1.Initialize("WebView1")
Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
WebView1.JavaScriptEnabled = True
WebView1.ZoomEnabled=False
WebViewExtras1.Initialize(WebView1)
'add the B4A javascript interface to the WebView
WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
WebSettings.setDefaultTextEncodingName(WebView1,"utf-8")
WebViewExtras1.LoadHtml(html)
Dim js As String
js = $"B4A.CallSub(setHTML('appVersion','1.0.0.2'))"$
WebViewExtras1.ExecuteJavascript(js)
setHtml is not starting.
Where i am wrong?
My javascript function is simple:
JavaScript:
<script>
function setHTML(elementId, val){
alert(val);
document.getElementById(elementId).innerHTML = val;
}
</script>