i am showing a HTML page to the user using webview control. at the bottom of the page i have added links to website that user can visit. but the problem is when the user clicks on the link, the page gets opened inside the webview even through i have used _blank as target for my links.
i want that if a user click certain links inside webview it should open the device's web browser.
Sub WebView1_OverrideUrl(Url As String) As Boolean
ToastMessageShow("Loading Page..." & CRLF & Url, False)
Dim p As PhoneIntents
StartActivity(p.OpenBrowser(Url))
Return False
End Sub
Thanks.
but that would make all links inside webview to open in web browser. i only want certain links to open in browser. is there an alternative? like inserting a HTML tag to the link and only those with that tag will open.
Sub WebView1_OverrideUrl(Url As String) As Boolean
ToastMessageShow("Loading Page..." & CRLF & Url, False)
'The character below ">" can be anything you want to add to the Link
If Url.StartsWith(">") Then
Dim p As PhoneIntents
StartActivity(p.OpenBrowser(Url))
Else
WebView1.LoadUrl(Url)
End If
Return False
End Sub
Sub WebView1_OverrideUrl(Url As String) As Boolean
ToastMessageShow("Loading Page..." & CRLF & Url, False)
'The character below ">" can be anything you want to add to the Link
If Url.StartsWith(">") Then
Dim p As PhoneIntents
StartActivity(p.OpenBrowser(Url))
Else
WebView1.LoadUrl(Url)
End If
Return False
End Sub
Shouldn't we get the '>' out of the link when loading?
Actually I don't really know how the browser will handle this extra char, perhaps it will not have a problem, but just to be sure: