• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: -stringByEvaluatingJavaScriptFromString: return value iphone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >-stringByEvaluatingJavaScriptFromString: return value iphone (From: Marco Cassinerio <email@hidden>)
 >Re: -stringByEvaluatingJavaScriptFromString: return value iphone (From: Peter Blazejewicz <email@hidden>)

  • Prev by Date: Re: How many processors?
  • Next by Date: maximum speedup bound on multi-core processors
  • Previous by thread: Re: -stringByEvaluatingJavaScriptFromString: return value iphone
  • Next by thread: Core Data relationship disappears
  • Index(es):
    • Date
    • Thread