Mono.Webkit (webkit-sharp), access c# objects, functions from javascript
I wrote a simple Gt开发者_如何学运维k Application with a Webkit Browser Widget (WebView) included. I want to access C# Objects (or C# functions) with Javascript in this Application.
I'm not sure if this is satisfiable as it's not the direct access, but you can 'access' C# objects and methods this way:
Create class that extends WebView
, and overwrite OnResourceRequestStarting()
method to catch javascript ajax requests. You can use them as a method calls from js. As an answer to those requests, you can call WebView.ExecuteScript()
and pass some parameters.
精彩评论