Android Question B4x Webview: Handling href and mailto links

Hi folks.
I've been working on a new project (B4x / V12.80 - Web-Browser) for quite some time now.
Now, as my work is progressing I noticed that the webview control can't seem to handle links like downloads (href) or mailto events.
Clicking on these links will result in no action whatsoever...
After doing some research here in this forum I discovered a few posts dealing with this problem seemingly with no real solution.

May I ask the more experienced users if there is a solution to this? Or is it just not possible to get this done?
Thanks so much.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
May I ask the more experienced users if there is a solution to this?
There is.

Or is it just not possible to get this done?
It is possible.

Clicking on these links will result in no action whatsoever...
Ok.

After doing some research here in this forum I discovered a few posts dealing with this problem seemingly with no real solution.
Unlikely.

Now, as my work is progressing I noticed that the webview control can't seem to handle links like downloads (href) or mailto events.
WebView isn't a complete browser. It is not built to handle these tasks automatically. You need to intercept those links with the OverrideUrl event.

Example:
B4X:
Private Sub WebView1_OverrideUrl (Url As String) As Boolean
    If Url.StartsWith("mailto:") Then
        Log("do something")
        Return True
    End If
    Return False
End Sub

Please be more concise. No need to enrich the question with unnecessary details.
 
Upvote 0
I got you - thanks for the "amusing" replies and remarks on my questions...
Don't get me wrong, I consider myself a novice-level developer who is just getting started.
It's not like I am not reading previous posts but I can't always comrehend them due to the lack of programming experience and knowlege.
Nonetheless, even beginners need start somewhere and thus may result in some "weired" questions.
Thanks Erel, this might get me going...
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Hi @EstasPerplejo,

Erel gave you the hint and that is how I added mail option from webview of my About page in my app.

You can check the details here,
 
Upvote 0
Top