In reading the WebKit documentation, I see I can directly evaluate Javascript in the embedded browser. Great! This handles passing messages from the native OSX app into the website.
However, I also need to be able to pass messages from my Javascript to trigger some code in the OSX application. I know how I would do this on the iPhone UIWebView: I would implement the UIWebViewDelegate class, and then implement a method like this:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
// Examine the request object and do whatever needs be done
return NO;
}
Coincidentally, I see that other users have come up with this solution for the iOS. However, I see no equivalent method in the OSX WebKit framework (eg, within the Frame Load Delegate).
Can anyone suggest best practices for passing a message from my Javascript to my OSX app?