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

Google Chrome: Set variable to result of JavaScript


  • Subject: Google Chrome: Set variable to result of JavaScript
  • From: Nathan Greenstein <email@hidden>
  • Date: Mon, 11 Jul 2011 13:28:42 -0700

Hi all,
I've been trying to get Chrome to do some _javascript_ in a tab, and set the result of that to an AppleScript variable.
Here's my code:

tell tab 1 of mywindow to set x to execute _javascript_ "return document.getElementById('mydiv').innerHTML;"

This works, but x is just set to missing value.

set x to tell tab 1 of mywindow to execute _javascript_ "return document.getElementById('mydiv').innerHTML;"

This won't compile.

I know the JS is good, because if I have Chrome alert() instead of return it works fine.

So, is this a bug somewhere or am I doing something wrong? Is there a way to get this to work?

Thanks!

--

Nathan Greenstein
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

  • Follow-Ups:
    • Re: Google Chrome: Set variable to result of JavaScript
      • From: Christopher Stone <email@hidden>
    • Re: Google Chrome: Set variable to result of JavaScript
      • From: Cameron Knowlton <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: a.out
  • Next by thread: Re: Google Chrome: Set variable to result of JavaScript
  • Index(es):
    • Date
    • Thread