• 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: 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

  • Prev by Date: Re: Incomprehensible KVC Failure!
  • Next by Date: Re: Incomprehensible KVC Failure!
  • Previous by thread: Re: Model & Table Cell Updating Issues
  • Next by thread: [ANN] KSOutlineView Framework/Interface Builder Plugin
  • Index(es):
    • Date
    • Thread