### Redirect URL to Default Browser

Example of redirecting an URL to the external default browser instead of loading in the webview (and replacing its content).
The example is taken from B4J HoTo sample project B4JHowToDYK3.
`Private Sub Class_Globals
Private WebView_DyK As WebView
' Handle location changed in case the content has a link starting with lowercase http: or www.
' The external url is opened in the default browser via showexternaldocument.
`Private Sub WebView_DyK_LocationChanged (Location As String)
' Capture the new location
Dim NewLocation As String = Location
If Location.ToLowerCase.StartsWith("http:") Or Location.ToLowerCase.StartsWith("www:") Then
' Load the tip content again!
WebView_DyK.LoadHtml(mTipSelected)
' Show the url starting with http://www in the external browser
fx.ShowExternalDocument(NewLocation)
End If
End Sub`
Content example used:
`<html><body>
This is an example text, containing an external URL. The text is loaded via LoadHTML and the following external URL is shown in the default browser.
Visit MySite" target="_blank">http://www.mysite">MySite
</body></html>
``

Changed: 2018-06-07 09:32, Category: WebView, File: T6C284M2170.htm, ID: 2170