I'm using axWebBrowser and I need to make a script work which works when selected item of a listbox is changed.
In default webBrowser control there is a method like;
WebBrowserEx1.Document.InvokeScript("script")
But in axWebBrowser I can not work any script! And there is no documentation about this control.
Anyone knows how ?
A late answer, but hopefully still may help someone. There is a number of ways to invoke a script when using WebBrowser ActiveX control. The same techniques can also be used with WinForms version of WebBrowser control (via webBrowser.HtmlDocument.DomDocument) and with WPF version (via webBrowser.Document):
There has to be at least one
<script>
tag for JavaScript'seval
to work, which can be injected as shown above.Alternatively, JavaScript engine can be initialized asynchronously with something like
webBrowser.Document.InvokeScript("setTimer", new[] { "window.external.notifyScript()", "1" })
orwebBrowser.Navigate("javascript:(window.external.notifyScript(), void(0))")
.