Transfer variables from the embedded web browser to the application

I would like to know if it is possible to transfer data from a C # application (e.g. WPF) to a web page (i.e. an HTML page with Javascript) into an embedded web browser. If so, how?

Thanks in advance for your help!

+4
source share
1 answer

You can call methods (and thus pass data) to your C # code from JavaScript using Window.external . Try searching this search query keyword. Additional information will appear quickly.

This blog post has a nice, simple (WPF-) example on how to call the C # method from JavaScript using Window.external . Another keyword here is [System.Runtime.InteropServices.ComVisibleAttribute(True)] . You must mark your handler class with such an attribute that it is accessible from JavaScript. And finally, you tell your WebBrowser control about the handler class through its ObjectForScripting property.

+3
source

All Articles