• 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: Google Chrome: Set variable to result of JavaScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Google Chrome: Set variable to result of JavaScript


  • Subject: Re: Google Chrome: Set variable to result of JavaScript
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 12 Jul 2011 12:32:40 -0400

On Tue, Jul 12, 2011 at 8:29 AM, Emmanuel LEVY <email@hidden> wrote:
I think it's not Chrome, it's _javascript_. Only functions can return values, not the "out-of-any-handler" program. Check ECMA's specs (I didn't).

Not sure what you mean by '"out-of-any-handler" program', but any _javascript_ _expression_ can return a value, whether it's a function call or not.  And many JS statements are in fact expressions as well.  What matters is whether or not the interpreter in question chooses to expose the value through whatever means was used to invoke it; Chrome's AppleScript interface appears not to do so.  (In Firefox, when you enter a _javascript_:_expression_ into the URL bar,you get a new page that contains the result of that _expression_ - unless you explicitly cast it to void - so it's easy to demonstrate that arbitrary _javascript_ can have a return value, no function call required.  Try "_javascript_:1+1", for instance.)

That's why Smile, the groundbreaking - yet, free! - _javascript_-Applescript bridge, proposes in its dictionary "callJavaScriptFunction" in addition to the usual "callJavaScript".

I'm not sure what that distinction buys you.  Wouldn't ' callJavaScriptFunction "someName"  ' be equivalent to ' callJavaScript "someName()" ' ?
--
Mark J. Reed <email@hidden>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Google Chrome: Set variable to result of JavaScript (From: Nathan Greenstein <email@hidden>)
 >Re: Google Chrome: Set variable to result of JavaScript (From: Christopher Stone <email@hidden>)
 >Re: Google Chrome: Set variable to result of JavaScript (From: Emmanuel LEVY <email@hidden>)

  • Prev by Date: Re: 24U Appearance and Snow Leopard
  • Next by Date: Re: Google Chrome: Set variable to result of JavaScript
  • Previous by thread: Re: Google Chrome: Set variable to result of JavaScript
  • Next by thread: Re: Google Chrome: Set variable to result of JavaScript
  • Index(es):
    • Date
    • Thread