<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It appears we dont have the WebScripting protocol bound as a [Model] yet:<div><br></div><div><a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html">http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html</a></div><div><br></div><div><a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html"></a>If we did you would want to have your NativeMessageReceiver inherit from WebScripting and override the methods.</div><div><br></div><div>Would you like to submit a patch to the webkit bindings that does this?</div><div><br></div><div>In the mean time you can use</div><div><br></div><div>[Export ("isSelectorExcludedFromWebScript:")]</div><div>static bool IsSelectorExcluded (Selector s) {</div><div>&nbsp;&nbsp;return false;</div><div>}<br><div><div>On 2011-02-25, at 11:01 AM, Clay Fowler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Is anyone successfully using&nbsp;WindowScriptObject in WebView to have Javascript communicate with your C# classes in a MonoMac project? I'm trying to do things like this:<div><br></div><div>...</div><div><br></div><div>webView.WindowScriptObject.SetValueForKey(new NativeMessageReceiver(),new NSString("NativeMessageReceiver"));</div>
<div><br></div><div>...</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>NSString handleMessage(NSString messageText)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>Console.Out.WriteLine("Got message from page [" + messageText + "]");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>return new NSString("OK");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>bool isSelectorExcludedFromWebScript(Selector s)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>return false;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div></div><div><br></div><div>But "isSelectorExcludedFromWebScript" and "handleMessage" never get called.</div>
<div><br></div><div>Any tips?</div>
_______________________________________________<br>Mono-osx mailing list<br><a href="mailto:Mono-osx@lists.ximian.com">Mono-osx@lists.ximian.com</a><br>http://lists.ximian.com/mailman/listinfo/mono-osx<br></blockquote></div><br></div></body></html>