Calling javascript object method using WebBrowser.Document.InvokeScript

前端 未结 3 1079
天命终不由人
天命终不由人 2020-12-09 21:05

In my WinForms application I need to call javascript function from my WebBrowser control. I used Document.InvokeScript and it works perfect with functions alone e.g

3条回答
  •  清歌不尽
    2020-12-09 21:48

     webBrowser.Document.InvokeScript("execScript", new object[] { "this.alert(123)", "JavaScript" })
    

    for you supposed to be like this

     webBrowser.Document.InvokeScript("execScript", new object[] { "obj.method()", "JavaScript" })
    

提交回复
热议问题