I'm porting a .NET app that uses the WebBrowser control, and has Javascript
that calls back into the C#.
It does this by stating "[ComVisible(true)] public class Foo { }", by having
an member variable 'browser' of type System.Windows.Forms.WebBrowser" in Foo,
and by calling "browser.ObjectForScripting = this" in Foo's constructor. After
those steps, the JavaScript can call back into Foo.Callback by calling
"window.external.Callback()".
On Cocoa/WebKit, that would be done by implementing the WebScripting protocol
in an object (the 4 methods that define how the selectors in Foo are exposed to
JavaScript) , then calling [someWebScriptObject setValue:someFoo
forKey:@"external"], then the JavaScript would be able to call
window.external.Callback_().
I'm trying (and failing) to figure out how to implement the 4 methods of the
WebScripting protocol so that they'll get called by Webkit. Two of them return
NSString*, and the "no op" case of returning nil is allowed.
Will I be able to define these 4 in C#, or will I need to create a pure
ObjectiveC object for this?
Thanks in advance.