I using WebViewExtras ver. 2.20
I am trying to call B4A sub from my web site
This below is my code but cant start b4a sub from html page loaded into WebView
And this is my html code:
Is this correct way to call b4a sub from html page?
I am trying to call B4A sub from my web site
This below is my code but cant start b4a sub from html page loaded into WebView
B4X:
Sub Globals
Dim WebView1 As WebView
Dim WebViewExtras1 As WebViewExtras
Dim html As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("111")
' WebView1.Initialize("")
WebViewExtras1.Initialize(WebView1)
' WebViewExtras1 now has all the methods and properties of WebView1 plus it's additonal methods and properties
' so you can use WebView1 to get/set WebView properties/methods
' or use WebViewExtras1 to get/set WebView1 properties/methods with the additional properties/method of WebViewExtras
Dim WebViewClient1 As DefaultWebViewClient
WebViewClient1.Initialize("WebViewClient1")
WebViewExtras1.JavaScriptEnabled=True
WebViewExtras1.SetWebViewClient(WebViewClient1)
WebViewExtras1.AddJavascriptInterface(WebViewClient1,"B4A")
WebViewExtras1.CanGoback()
WebViewExtras1.LoadUrl("https://192.168.0.106/MobileOffice/D2548BA4-E6FD-43A0-9423-F4AE0BC7B710/Phone/Auth/Authorize/" & pId.GetDeviceId)
End Sub
Sub WebViewGoBack_Request()
WebViewExtras1.GoBackOrForward(-1)
Log(9)
End Sub
And this is my html code:
HTML:
<div class="left">
<a href="javascript:;" onclick="goBack()" class="headerButton"> <!--goBack-->
<ion-icon name="chevron-back-outline"></ion-icon>
</a>
</div>
<script>
function goBack() {
B4A.CallSubPlus('WebViewGoBack_Request', true);
}
</script>
Is this correct way to call b4a sub from html page?
Last edited: