1

Possible Duplicate:
Invoke C# code from JavaScript in a Document in a WebBrowser

Not sure that this would be possible with the WinForms browser control, but I would like to somehow setup a hook or callback that I can define a function from C# to javascript, when the javascript calls that function I would like it to execute a C# method. A simple example would be that I am writing a web application and running it inside a C# WinForms native client (so it appears to be a real windows program.) I need to expose file i/o and directory iteration methods to the Javascript so that my web application can access the file system without needing to load any additional java applets or flash.

Please note I am not requesting third party libraries that would expose this functionality, I am asked for resources or an explanation on how I can create this and any other functionality that I might need.

4
  • 4
    WebBrowser.ObjectForScripting looks like what you need, msdn.microsoft.com/en-us/library/… Commented Jan 24, 2013 at 18:19
  • ObjectForScripting it is, thanks mark Commented Jan 24, 2013 at 18:20
  • Richard appears you are right, my apologies. Commented Jan 24, 2013 at 18:24
  • Checkout the Extension Methods code samples I added to the linked answer stackoverflow.com/a/27467957/262379 Commented Dec 14, 2014 at 9:28

0