I know we can call Java script from UIWebView
using stringByEvaluatingJavaScriptFromString
but can I call Java Script from any other place other than a view controller?
I am displaying a UIPopover
from a WebView I want to call js code from the popover to make changes in web page displayed below.
I tried calling a method in webview from popover's viewcontroller to call js, the methord is called but nothing happened
ViewController in popover
webView =[WebViewController alloc]init];
[webView methodToCallJs];
WebViewController
-(void)methodToCallJs
{
[_webView stringByEvaluatingJavaScriptFromString:@"sampleFunction()"];
}
Is there a way to do this ??
我认为您正在寻找的是http://code.google.com/p/jsbridge-to-cocoa/的功能
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.