Re: Execute Javascript on an HTML file
Re: Execute Javascript on an HTML file
- Subject: Re: Execute Javascript on an HTML file
- From: Jim Skibbie <email@hidden>
- Date: Fri, 26 Apr 2013 22:22:38 +0000
- Thread-topic: Execute Javascript on an HTML file
Paul-
This has some real potential! I like that it is a single binary with no
dependencies, so I could tuck the whole phantomjs into my Applescript
application and call it internally.
My goal was to find something that didn't require maintaining an
environment on multiple workstations to get my task accomplished.
Thanks for the link. I will definitely check this out.
On 4/26/13 4:35 PM, "Paul Scott" wrote:
>Maybe http://phantomjs.org/ would help.
>
>Paul
>
>On 4/26/2013 2:11 PM, Paul Scott wrote:
>> On 4/26/2013 1:36 PM, Jim Skibbie wrote:
>>> I was hoping someone might know of a way to interact with an
>>> underlying Javascript framework that could be executed to get the
>>> same result without having to utilize the Safari browser.
>>
>> I don't have a good answer, but I want to point out that Javascript by
>> itself doesn't buy you anything you couldn't do in another language,
>> even AppleScript.
>>
>> Javascript becomes useful in a web browser by virtue of the DOM tree
>> and the globals‹methods and objects‹provided by the web browser.
>> Without that, Javascript has to parse the HTML the long hard way. Has
>> anyone written an HTML parser in Javascript? That's a large exercise
>> for such a small user base, given that most Javascript dealing with
>> HTML runs in a browser, which gives you the DOM for free. And even
>> then you'd still have to provide a container for your Javascript that
>> gives you access to the document.
>>
>> You could, of course, use the V8 engine in a native
>> application‹callable from AppleScript‹that provides access to the
>> document, but again, you'd have to parse the HTML yourself. Perhaps
>> there's some open source stand-alone container (possibly employing V8)
>> available that doesn't render anything but provides a DOM and
>> Javascript. That seems like a useful tool, actually; at least for your
>> purposes.
>>
>> Paul
_______________________________________________
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