Android Question Open a hyperlink on a page in another webview

appie21

Active Member
Licensed User
Longtime User
Hello

I have 2 webviews
In one of the webviews there is loading a page with a hyperlink

B4X:
<marquee behavior="scroll" direction="left">
<a href="https://www.b4x.com/android/forum/" target="_blank" style="color: yellow">Open site</a>
</a>


If I click the link the page will open in the same webview as where the hyperlink is.

What i want is that when i click the hyperlink it open the link in the second webview
 

stevel05

Expert
Licensed User
Longtime User
Use the OverrideURL callback of webview and load the url into the second webview:

B4X:
Sub WebView1_OverrideUrl(Url As String) As Boolean
    WebView2.LoadUrl(Url)
    Return True  'Return True to make webview1 ignore the link
End Sub
 
Upvote 0
Top