[Mono-osx] WebView WindowScriptObject
Geoff Norton
gnorton at novell.com
Fri Feb 25 11:12:12 EST 2011
It appears we dont have the WebScripting protocol bound as a [Model] yet:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html
If we did you would want to have your NativeMessageReceiver inherit from WebScripting and override the methods.
Would you like to submit a patch to the webkit bindings that does this?
In the mean time you can use
[Export ("isSelectorExcludedFromWebScript:")]
static bool IsSelectorExcluded (Selector s) {
return false;
}
On 2011-02-25, at 11:01 AM, Clay Fowler wrote:
> Is anyone successfully using WindowScriptObject in WebView to have Javascript communicate with your C# classes in a MonoMac project? I'm trying to do things like this:
>
> ...
>
> webView.WindowScriptObject.SetValueForKey(new NativeMessageReceiver(),new NSString("NativeMessageReceiver"));
>
> ...
>
> NSString handleMessage(NSString messageText)
> {
> Console.Out.WriteLine("Got message from page [" + messageText + "]");
> return new NSString("OK");
> }
>
> bool isSelectorExcludedFromWebScript(Selector s)
> {
> return false;
> }
>
> But "isSelectorExcludedFromWebScript" and "handleMessage" never get called.
>
> Any tips?
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110225/c9f29780/attachment.html
More information about the Mono-osx
mailing list