Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private WebView1 As WebView
Private html As String
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
html = $"<a href="https://www.w3schools.com">Open page in default browser</a>"$
WebView1.LoadHtml(html)
End Sub
Private Sub WebView1_LocationChanged (Location As String)
If Location.Contains("w3schools") Then
Sleep(0)
WebView1.LoadHtml(html)
OpenBrowser(Location)
End If
End Sub
Private Sub OpenBrowser (url As String)
Dim shl As Shell
shl.Initialize("shl", "cmd", Array As String("/c", "start", url))
shl.Run(3000)
End Sub