WebViewExtras1.AddJavascriptInterface(jsi,"BB")
...
Sub md5(str As String) As String
Dim j As JavaObject
j.InitializeContext
Dim s As String
s = j.RunMethod("getMD5",Array(str))
s=s.ToUpperCase
Log("return>>>"&s)
Return s
End Sub
Sub lg(s As String)
LogColor(s,Colors.Magenta)
End Sub
JavaScript:
function nt(){
BB.CallSub("lg",false,"before md5");
var s;
s=BB.CallSub("md5",false,"1");
mss.innerText ="и md5="+ s;
BB.CallSub("lg",false,"after md5 =" + s);
//alert("1="+s);
}
i'am run javascipt.nt() function + view log window:
I'm waiting for the result in the function as shown in the screenshot, but it's = undefined.
What am I doing wrong?
i answered a similar question almost 3 years ago to the date. you should have searched. download the example in post #4 and compare it with yours. i don't think you set up your code correctly. just pay attention to how the javascript interface is set up in webviewextras2. it's not the same as for webviewetras. just the javascript interface. the rest is not applicable.
I noticed a lot of beginners are confused about how to use the WebViewExtras library so I made a detailed example. If you find it useful, kindly consider buying me a coffee. Code works on Android 4.4 to Android 14 (last tested version). It should work for the latest Android versions but I...
thanks for Our answers, I'm resigned
1.WebViewExtras2.DefaultJavascriptInterface..CallSub(...) in debug mode - Does not return a value result
2.if sub no exists WebViewExtras2.DefaultJavascriptInterface..CallSub(...) = returns a string error message instead of Null or Error