Special case when calling InvokeScript with the winforms WebBrowser control does not work
        Posted  
        
            by wang-min
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by wang-min
        
        
        
        Published on 2010-04-20T10:50:25Z
        Indexed on 
            2010/04/20
            10:53 UTC
        
        
        Read the original article
        Hit count: 547
        
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?
© Stack Overflow or respective owner