cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: javascript

From: Ben Madsen - Mailing List <bmadsen_at_ecbridges.com>
Date: Wed, 22 Mar 2006 10:28:41 -0800

Because javascript is processed on the client (the web Browser), and not
on the server. Curl, in this case, acts as a very simple client, only
sending and interpreting HTTP requests. It does not decode HTML or any
other data that is recieved over the HTTP channel, but leaves that up to
you to process. If you were to send anything "back", you'd be sending
them to the server, which doesn't internally know about javascript. The
best way to do it would be to integrate your libcurl application with
another web browser (client) that understands HTML and Javascript and is
able to process them. Of course, given the possible complexity of the
Javascript functions in question, it may not be possible to do what you
want as the secondary web browser may decide to take over when the
javascript function is called and submit it's form contents to the
server (as the javascript:formname.submit() function does).

The important question here is to ask, what are you really trying to
do? Do you need to process the javascript to make that work, or is
there another way using pure HTTP requests with HTML interpretation in
your libcurl application?

-Ben Madsen

Ralph Mitchell wrote:

>OK, I'm completely iggerant about Applescript and Safari, but why
>couldn't you use curl to telnet to the webserver and simply send that
>text?? It's not curl that needs to handle the javascript, it's the
>target system. Curl would just see characters to send, right??
>
>Ralph Mitchell
>
>
>On 3/22/06, Doug McNutt <douglist_at_macnauchtan.com> wrote:
>
>
>>In Mac OS neXt one can use AppleScript to ask Safari to "do" a Javascript.
>>
>>
>>
>>> tell application "Safari"
>>> (do JavaScript "document.readyState" in document 1 of window id winID)
>>> end tell
>>>
>>>
>>It's likely that other browsers have the same kind of capability to run their Javascript engines when asked with some kind of interprocess request. Whether it's worthwhile here is another question unless you're just trying to figure out what the Javascript does so you can emulate it in, say, perl.
>>
>>--
>>
>>--> From the U S of A, the only socialist country that refuses to admit it. <--
>>
>>
>>
>
>
>
Received on 2006-03-22