B4i JavascriptInterface

B4i does not yet have a library to add a JavaScript Interface like WebviewExtras in B4A that uses addJavascriptInterface.

Based in this thread https://www.b4x.com/android/forum/threads/b4i-addjavascriptinterface.72837/#post-462960

I used this method that way and put this in the html file

    location.href = "#Page_Loaded";
</ script>

B4i to watch what is happening in the script html:

Sub Webview1_OverrideUrl (Url As String)
    If Url.Contains ("#Page_Loaded") Then
        'Do something
    Else if Url.Contains ("#showall") Then
        'Do something
    End If
End Sub

You can use anything with '#'

the hash tag # does not redirect the browser to any location, remaining in the same state and at the same time, allowing a string parameter to be passed to the OverrideUrl event

I hope it's useful. Like this to let me know that this worked for you too. ;)
Last edited: