Embeding Firefox Brower (Gecko Engine) In C# Using GeckoFX

Updated sandeepparekh9 0 Tallied Votes 918 Views Share

Ever Thought if it was possible to not WebBrower control and use the Firefox Browser in your c# window Application...??

Yes ,, It is possible using GeckoFx wrapper class for C#.net and vb also.

You will need the Followings:

1. GeckoFx Wrapper
2. Xul Runner (Download the zip file from here)

For Complete tutorial and download links : [snipped]

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Skybound.Gecko;

namespace GeckoNet
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Skybound.Gecko.Xpcom.Initialize("c:\\xulrunner\\"); //Whatever the path to xulrunner runtime 
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            geckoWebBrowser1.Navigate("www.google.com");
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            geckoWebBrowser1.Stop();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            geckoWebBrowser1.Refresh();
        }

        private void btnSavePage_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = " Html File | *.html";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                geckoWebBrowser1.SaveDocument(sfd.FileName);
            }
        }
    }
}
skatamatic 371 Practically a Posting Shark

With IE9 blowing firefox out of the water, I don't expect this to be useful until Firefox ups its game.

newlonator 0 Newbie Poster

I have no errors in my code and my code is the exact same as the code provided, but when i run it i get and OutofMemoryException. Help Please!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.