I use an HTMViewer control in order to display a html file which contains a mailto: - link.
If I open that html file in any browser, clicking von that mailto:-link opens the standard eMail client, using the eAMil address speified in the mailto-link.
But:
Using the html viewer control, the behaviour is not as expected.
under OS X, nothing happens
under Windows, the following error message is displayed: “Error -302 when loading mailto:xxx@xxx.com”
The simplest way to go is in the CancelLoad event when mailto: is in the URL, and simply ShowURL the url in question and return True. The system will then open the default mail client, as it does in regular browsers.
Thank you all for your efforts and attempts to help me!
Michel, indeed I had to put the following code in the CancelLoad event:
If URL.StartsWith("mailto:") Then
ShowURL URL
Return True
End If
That does the magic…
By the way:
the function StartsWith is an extension to my string class:
[code]Function StartsWith(Extends srcString as String, search as string) As Boolean
If srcString = “” Then Return False
If search = “” Then Return False
Dim anz As Int32 = search.Len
If anz > srcString.Len Then Return False
If Left(srcstring, anz) = search Then
Return True
Else
Return False
End If
End Function[/code]