Re: -stringByEvaluatingJavaScriptFromString: return value iphone
Re: -stringByEvaluatingJavaScriptFromString: return value iphone
- Subject: Re: -stringByEvaluatingJavaScriptFromString: return value iphone
- From: Brent Fulgham <email@hidden>
- Date: Tue, 17 Mar 2009 15:49:33 -0700
On Sat, Jan 31, 2009 at 9:10 AM, Marco Cassinerio
<email@hidden> wrote:
> Hi,
>
> i'm trying to execute a javascript function on the iPhone and get the return
> value.
>
> The function is simple:
> return "hello";
>
The iPhone uses a new version of WebKit than ships on the Mac (unless
you install a WebKit nightly, or are using the Safari 4.0 beta).
You can confirm this using the jsc command-line program (built with
WebKit). In earlier versions, it would support the 'return "hello";'
example as expected, but the new Squirrelfish (or whatever it's
advertising name is nowadays) will not.
If you just change to Peter's formulation:
"(function () {return "hello";}) ();"
... everything should work as you expect.
Think of it as future-proofing your code for Safari 4.0! :-)
-Brent
_______________________________________________
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