How can execute Javascript function with parameters via GeckoFX?

710 views
Skip to first unread message

Christian LeMoussel

unread,
May 11, 2014, 3:53:17 AM5/11/14
to
I try to execute a javascript function with some arguments via GeckoFX and C# but I can not.

I try without results with this C# code :

string JSresult = "";
string JStext = @"
function GeckoFXJSTest(val1, val2)
{
return val1 + val2;
}
";

GeckoScriptElement script = GeckoBrowser.Document.CreateElement("script") as GeckoScriptElement;
script.Type = "text/javascript";
script.TextContent = JStext;
GeckoBrowser.Document.Head.AppendChild(script);
using (AutoJSContext JScontext = new AutoJSContext(GeckoBrowser.Window.JSContext))
{
JScontext.EvaluateScript("GeckoFXJSTest(10,7)", out JSresult);
}

Can anyone help me?
Reply all
Reply to author
Forward
0 new messages