Android Question WebView + Javascript in _OverrideUrl and _PageFinished

peacemaker

Expert
Licensed User
Longtime User
HI, All

2 kinds of href links:
B4X:
1) <a href = "folder/file.html">LINK</a>
2) <a id="vhod" href="#vhod" class="ui-btn">Enter link</a>
Found that in old Android < 4.4:
1) First link is catched OK always in webview_OverrideUrl event
2) Second link is catched only in webview_PageFinished

In new Android 5:
1) First link is catched in webview_OverrideUrl event
2) Second link is not catched at all !

What is the miracle ?

Used this init with WebViewExtras2 v.2.20:
B4X:
Sub Globals
Dim CookieManager1 As CookieManager
    Dim wv As WebView, wvs As WebViewSettings
    Dim WebViewExtras1 As WebViewExtras
    Dim WebChromeClient1 As DefaultWebChromeClient
    Dim JavascriptInterface1 As DefaultJavascriptInterface
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")

    WebViewExtras1.Initialize(wv)
    WebViewExtras1.JavaScriptEnabled = True
  
    JavascriptInterface1.Initialize
    WebViewExtras1.AddJavascriptInterface(JavascriptInterface1, "B4A")

  
    WebChromeClient1.Initialize("WebChromeClient1")
    WebViewExtras1.SetWebChromeClient(WebChromeClient1)
  
    wvs.setUseWideViewPort(wv, True)
    wvs.setDisplayZoomControls(wv, False)
    wvs.setLoadsImagesAutomatically(wv, True)
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
hrefs like
2) <a id="vhod" href="vhod:" class="ui-btn">Enter link</a>
is catched OK.

But strange behaiviour.
 
Upvote 0
Top