Re: -stringByEvaluatingJavaScriptFromString: return value iphone
Re: -stringByEvaluatingJavaScriptFromString: return value iphone
- Subject: Re: -stringByEvaluatingJavaScriptFromString: return value iphone
- From: Peter Blazejewicz <email@hidden>
- Date: Sat, 31 Jan 2009 23:47:49 +0100
hi Marco,
I'm not John Resig (http://ejohn.org/) but I would not assume that
"return o" will actually evaluate to javascript object/function call,
I would rather script:
NSString *scriptCode = @"\"Hello\"";
or:
NSString *scriptCode = @"(function(){return \"hello\";})();";
but I would also fire up Safari (WebKit) script console (ALT+CMD+C)
and take few trials with code.
Because you're correct of differencies between UIWebView and WebView
(@"return \"hello\"" works in WebView) I would look into other place
(webkitsk-dev list). Maybe that is because WebKit on OS X is bridged
JavaScript<>Objective-C while on Touch OS is not ("return o" does not
work in WebKit/Safari interactive console while it works in WebView
string code evaluating call).
regards,
Peter
On Jan 31, 2009, at 10:23 PM, Marco Cassinerio wrote:
Hi Peter,
i tried:
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"finished: %@",[webView
stringByEvaluatingJavaScriptFromString:@"return \"hello\""]);
}
but it doesn't work, while on os x it does.
Thanks
Marco
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden