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 [Download]
2. Xul Runner [Download] (Download the zip file from here)
How to:
1. Now Extract Skybound.GeckoFX.bin.v1.9.1.0.zip (First download).
You will find Skybound.Gecko.dll and that's what we need.
2. Now create a Project and name is GeckoFxcsharpBorwer or anything you like.
3. Now add the reference of the above dll and also add that to your toolbox.
4. Now Exctract the Second downloaded file (xulrunner-1.9.1.2.en-US.win32.zip). and you will find xulrunner . This is the path to xulrunner runtime.
5. Create a Form Layout Like The Figure Below:
Now The Coding Part:
Our Form's Constructor:(Providing the Path to XulRunner Runtime)
Form's Load Event:
Stop Button click Event:
Refresh Button Click Event:
Save Page Button Click Event:
And Now Finally the Output:
That's All.
Complete Project : GeckoNet
ps: You can easily Add an Addressbar and other stuff
Yes ,, It is possible using GeckoFx wrapper class for C#.net and vb also.
You will need the Followings:
1. GeckoFx Wrapper [Download]
2. Xul Runner [Download] (Download the zip file from here)
How to:
1. Now Extract Skybound.GeckoFX.bin.v1.9.1.0.zip (First download).
You will find Skybound.Gecko.dll and that's what we need.
2. Now create a Project and name is GeckoFxcsharpBorwer or anything you like.
3. Now add the reference of the above dll and also add that to your toolbox.
4. Now Exctract the Second downloaded file (xulrunner-1.9.1.2.en-US.win32.zip). and you will find xulrunner . This is the path to xulrunner runtime.
5. Create a Form Layout Like The Figure Below:
Now The Coding Part:
Our Form's Constructor:(Providing the Path to XulRunner Runtime)
public Form1() { InitializeComponent(); Skybound.Gecko.Xpcom.Initialize("Path To the xulrunner directory [Extracted from the Second Downloaded File]"); // for example "c:\\xulrunner\\" }
Form's Load Event:
private void Form1_Load(object sender, EventArgs e) { geckoWebBrowser1.Navigate("www.google.com"); }
Stop Button click Event:
private void btnStop_Click(object sender, EventArgs e) { geckoWebBrowser1.Stop(); }
Refresh Button Click Event:
private void btnRefresh_Click(object sender, EventArgs e) { geckoWebBrowser1.Refresh(); }
Save Page Button Click Event:
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); } }
And Now Finally the Output:
That's All.
Complete Project : GeckoNet
ps: You can easily Add an Addressbar and other stuff
20 comments:
you are welcome :)
Does this control require running on a STA thread like the web browser control in .net?
sir can u teach me how to add reference using gecko? like print.always_print_silent, true
great dude; thank you very much!!!
Nice work and very nice example !!!
Thank you it helps me a lott
i don't see geckoWebBrowser1 . How can i ?
yes, nice, but really too short ! How can I add the reference to the toolbox ???
How to enable to open new window and popup?
@Phillip Bismonte : Adding reference is easy. Find the references in your Visual Studio Solution Explorere. Right click and add Reference. Choose the DLL.
@Marco Pagaroli: Adding reference is easy. Find the references in your Visual Studio Solution Explorere. Right click and add Reference. Choose the DLL.
For Adding to Toolbox , Right click anywhere on ToolBox panel and select "Choose Items" -> Go to .NET Frame work component -> Browse for the DLL file and you will find the "GeckoWebBrowser" component.
Click OK
If I run this on another PC it doesnt start, how to fix this issue?
How to add inspect element or console.
Show Error in Program.cs.
"Specified Cast is not valid"
on
Application.Run(new Form1());
How to call click event of a button from code?
thanks sir...can u help me for update fx , this working but i want to upgrade version...if have any opetion please share with all reader....i thing it's help full question all adv programmer
THIS CODE RUN INTERNET EXPLORER , NOT MOZILA FIREFOX
This is running internet explorer only, but not firefox. please give me some solution to run fire fox.
sfd.FileName = "geckoprint";
sfd.InitialDirectory = @"C:\Users\SAURABH\Desktop\applicatio";
sfd.Filter = " Html File | *.html";
if (sfd.ShowDialog() == DialogResult.OK)
{
geckoWebBrowser1.SaveDocument(sfd.FileName);
}
thx for updating this
Post a Comment