Special case when calling InvokeScript with the winforms WebBrowser control does not work
- by wang-min
I am trying to use InvokeScript method on the WebBrowser control to execute a script on the web page that has been loaded into my WebBrowser control. If I am calling just a simple javascript function, this works properly. However, the javascript function that I am trying to call is nested within a variable like this:
var holder =
{
DoA: function()
{
....
},
DoB: function()
{
.....
}
}
Calling holder.DoA works fine when called from within the javascript, but the function is not called successfully when I try to call it from within my C# code like this:
object obj1 = m_webBrowser.Document.InvokeScript("holder.DoA");
Any ideas?