On Sat, Jan 31, 2009 at 9:10 AM, Marco Cassinerio
<marco.cassine...@gmail.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to