dim webview1 as webview
webview1.Initialize("webview1")
webview1.LoadURL("http://xxx")
Sub webview1_PageFinished(urlpage As String)
Log (urlpage)
end sub
You will need to set up a Javascript Interface. With that, you can call JS functions from B4A and call B4A Subs from JS. It's the same functionality.
Just use the search function and youll find some good tutorials on how to do that. If you have any further questions to that, feel free to ask me, im using JS interfaces very often.
You will need to set up a Javascript Interface. With that, you can call JS functions from B4A and call B4A Subs from JS. It's the same functionality.
Just use the search function and youll find some good tutorials on how to do that. If you have any further questions to that, feel free to ask me, im using JS interfaces very often.
Sub Globals
Private wvJS as WebView
Private wwX as WebViewExtras
End Sub
Sub Activity_Create(isFirst as Boolean)
wwx.addJavascriptInterface(wv, "B4A")
wwx.addWebChromeClient(wv,"chromeclient")
End Sub
Sub wvJS_PageFinished(Url as String)
wvJS.LoadUrl("javascript:bridgeactive()")
End Sub
Sub msgbox(title as String, text as String)
MsgBox(text,title)
End Sub
In JS:
B4X:
function bridgeactive(){
B4A.CallSub("msgbox",true, "Title","It works!");
//Set CallUIThread to true because youre modifying the UI
//You can also get a Return Value, but only if its set to false
}
Sub Globals
Private wvJS as WebView
Private wwX as WebViewExtras
End Sub
Sub Activity_Create(isFirst as Boolean)
wwx.addJavascriptInterface(wv, "B4A")
wwx.addWebChromeClient(wv,"chromeclient")
End Sub
Sub wvJS_PageFinished(Url as String)
wvJS.LoadUrl("javascript:bridgeactive()")
End Sub
Sub msgbox(title as String, text as String)
MsgBox(text,title)
End Sub
In JS:
B4X:
function bridgeactive(){
B4A.CallSub("msgbox",true, "Title","It works!");
//Set CallUIThread to true because youre modifying the UI
//You can also get a Return Value, but only if its set to false
}