Overview

For a Basic understanding for the purpose of this article, it is unfortunate that Internet Explorer has became a dead application, and is no longer supported. With that said it is very insecure and high risk to use it in your applications. As a solution I recommend using Gecko which is also open source, so you can also build from the source (it is in C#). This article will cover some basic concepts that are needed to convert to, or use Gecko.


TIP: And as the source is built from, you will find most tutorials and guides are written in C#, if you ever come across such you can always use a code converter to make the code work.

For the sake of simplicity, I am not going to the trouble of going over Flags, or Custom classes.


Installation

Installation of Gecko can be done via the Nuget Package Manager, there is Gecko 32-Bit and Gecko 64-Bit They also offer a Linux Compatible version, if you are developing on Linux . The Control itself is supported on Windows Forms, WPF and Mono Framework. Installation is pretty easy, just search for one of the linked packages above, and you will be able to install the latest version as of the writing of this article.

First Steps

For best results, I have found that creating the control pragmatically works best. If you just have to use the drag and drop onto your form, you will need to rebuild your project after installation.

To create your control you simply create it like any other.

Important: You will need to Import Gecko for it to work, otherwise you will see errors.

Code:
'Initialize Gecko
 Xpcom.Initialize("Firefox"
Dim brws as new GeckoWebbrowser
Me.controls.add(brws)
Optionally here you can also add the Browser control to a tab control, or even dock it.


To navigate with Gecko, it is the same concept as the Webbrowser Control


Navigation:

Code:
brws.navigate("https://google.com")



Back:


Code:
brws.GoBack()

Forward:

Code:
brws.GoForward
Refresh:

Code:
brws.Refresh()
Compatibility Issues


Compatibility Errors on Sites

On the Fly you may notice the control still seems dated. That is because it is not being recognized as a newer version of Gecko and instead it is defaulting to NetScape.

To fix this, you need to declare the User Agent String, when the control is added to your form.

Note: If you use Gecko 60 as the user string you will still get the compatibility errors, just use the latest version in your string to suppress them.

Code:
    Dim sUserAgent As String = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/66.0"

                GeckoPreferences.User("general.useragent.override") = sUserAgent
                GeckoPreferences.Default("general.useragent.override") = sUserAgent
SSL Errors

This next solution is quite simple as well to overturn, if your site does not use a valid SSL or has a mixed SSL Response, you will get SSL errors. You can however suppress these errors, and navigate anyway.

DISCLAIMER: DO NOT allow users to navigate off site of trusted sites that are YOURS. Suppressing SSL is very insecure, and should only be used for compatibility.


Whenever you navigate you will need to add a handler to Suppress SSL Errors.

The Handler:

Code:
 Private Sub IgnoreSSLError(ByVal sender As Object, ByVal e As Gecko.Events.GeckoNSSErrorEventArgs)
        If Not e.Message.ToLower().Contains("certificate") Then
            MsgBox(e.Message)
            e.Handled = False
            Return
        End If
        e.Handled = True
        CertOverrideService.GetService().RememberValidityOverride(e.Uri, e.Certificate, CertOverride.Mismatch Or CertOverride.Time Or CertOverride.Untrusted, True)
    brws.Navigate(e.Uri.AbsoluteUri)
    End Sub


Implement:

Code:
  AddHandler brws.NSSError, AddressOf IgnoreSSLError
Other Things of Interest

If you want to create a Done Event, or Loading Event, you can do one similar to suppressing SSL Errors, anytime you navigate you will need to call the handler.

Loading
Code:
 Public Sub Loading(ByVal sender As Object, ByVal e As Gecko.GeckoProgressEventArgs)
'Do Events
End Sub
Done

Code:
 Public Sub Done(ByVal sender As Object, ByVal e As Gecko.Events.GeckoDocumentCompletedEventArgs)
'Do Events
End Sub

Conclusion

In Conclusion moving over to Gecko is pretty simple, only the basics were covered here for now. An Example project will be built and added eventually.

If you have questions or concerns, please ask away, if I can not answer them, you will be asked to go post your question in another thread for further assistance.


Usage

Gecko is MPL Licensed, all work covered here in this Tutorial is licensed under Creative Commons Attribution 4.0 International