The questions says it all. I have everything wired up and know how to send messages from the browser html to c#, but not the other way.
I should be able to do something like:
browserControl.JSCall("myFunction('Dave','Smith');");
...and in the web code:
function myFunction(firstName, lastName) {
$("#mydiv").text(firstName + ' ' + lastName);
}
Thanks - Dave
I know about AutoJSContext class so there is no need for passing javascript to Navigate().
Besides using
Navigate
method, you have this another workaround:You can do this using Navigate:
Note, I find that the code isn't actually run until the application event loop executes. If that's a problem for you, you might be able to follow the Navigate call with
Make sure you consider the dangers of calling DoEvents explicitly.
Dear @SturmCoder and @DavidCornelson are right. but it seems that for version 60.0.24.0
geckoWebBrowser1.JSCall()
and
Gecko.AutoJSContext() which accepts geckoWebBrowser1.JSContext
are absolete and instead of geckoWebBrowser1.JSContext you should write geckoWebBrowser1.Window
and for me this codes works :
or even if the website has jQuery you can run like this :