iOS Question Webview ignores links with target="_blank"

Martin Larsen

Active Member
Licensed User
Longtime User
In B4A, a link which in a normal browser opens in a new tab, just opens in the same webview. In other words, it ignores the target="_blank" attribute.

In B4i, the webview instead ignores the link completely. It doesn't open.

Right now my fix is:
B4X:
Private Sub wv_PageFinished (Success As Boolean, Url As String)
  Dim js as String = $"document.querySelectorAll("a[target='_blank']").forEach(a => a.target="_self")"$
  wv.EvaluateJavaScript(js)
End Sub

But that is really not elegant.

The problem is addressed here but I don't know how to convert it to B4i.

Any ideas?
 
Top