C # geckoFX (not used)

im new here hoping for some help with geckoFX in c #

so I just downloaded geckoFX and did the following.

1.Loaded: geckofx.dll

2.download: xulrunner

I have successfully added the geckofx browser and it works fine, but when I try to run this code to add javascript to the page, I get an error.

The error im get: skybound.geckoFX.AutoJSContext does not contain a definition to evaluate the script and jscontext.

Also I don't know if this helps, but AutoJSContext and EvaluateScript are not covered.

Here is my code

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


namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        Skybound.Gecko.Xpcom.Initialize(@"C:\Program Files\xulrunner");
    }

    private void geckoWebBrowser1_DocumentCompleted(object sender, EventArgs e)
    {
        string outString = "";
        using (AutoJSContext java = new AutoJSContext(geckoWebBrowser1.Window.JSContext))
        {
            java.EvaluateScript(@"window.alert('alert')", out outString);
        }


    }
}

      

Thanks for the advanced one.

+3


source to share


1 answer


You must call EvaluateScript like so:



java.EvaluateScript(@"window.alert('alert')", (nsISupports)geckoWebBrowser1.Window.DomWindow, out result);

      

+2


source







All Articles