[scriptObject evaluateWebScript:@"mouseClickCallBack = function() { SampleWebViewApp. mouseClickCallBack(); } "];
I have a WebView
and I am able to capture the mouseEvents
using JavaScript
. Now I want to insert textarea
at the mouse clicked position,for that I have to add the textarea
, I would like to add it in the Objective C
.How would I notify the events
from JavaScript
to Objective C
.This is for MAC OSX (cocoa)
not for iPhone
. What delegates
of the webview
should I use to accomplish this?
Please suggest any alternative to accomplish the same ?
I have gone through this link.
How to call Objective-C from Javascript?
But it is for UIWebView
I implemented the following API of WebView
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector
{
if ((selector == @selector(mouseClickCallBack))
{
return NO;
}
return YES;
}
But I am not sure where should I call the following code for mouseClick.
WebScriptObject *scriptObject;
[scriptObject evaluateWebScript:@"mouseClickCallBack = function() { SampleWebViewApp.mouseClickCallBack(); } "];