Calling javascript functions from a java application

A

arun.hallan

Hi,

Is it possible to link into a javascript DOM online from a java
application on my desktop, so i can hook into the functions which
return data. There is a website which displays data but i would like
to try and hook into it so i can retrieve data in a more efficient
manner.

Regards
 
B

Bart Van der Donck

Is it possible to link into a javascript DOM online from a java
application on my desktop, so i can hook into the functions which
return data. There is a website which displays data but i would like
to try and hook into it so i can retrieve data in a more efficient
manner.

I don't believe this is possible because the remote resource will
always return the raw (javascript) code, and not the result of the
function. Even when the remote function would be executed (e.g. by
passing a parameter in the query string from DeskTop), this does not
affect the output.

When Java uses a built-in browser (or launches MSIE), the remote
javascript code cannot leave its execution environment (which is the
browser in this case).

The traditional approach is to load the data as a whole, and then
manipulate it from within Java. For example, if the output file is an
XML-file, use the Java routines to access its DOM.

Hope this helps,
 
T

Thomas 'PointedEars' Lahn

Is it possible to link into a javascript DOM online from a java
application on my desktop, so i can hook into the functions which
return data. There is a website which displays data but i would like
to try and hook into it so i can retrieve data in a more efficient
manner.

Please restate your request.


PointedEars
 
A

arun.hallan

I don't believe this is possible because the remote resource will
always return the raw (javascript) code, and not the result of the
function. Even when the remote function would be executed (e.g. by
passing a parameter in the query string from DeskTop), this does not
affect the output.

When Java uses a built-in browser (or launches MSIE), the remote
javascript code cannot leave its execution environment (which is the
browser in this case).

The traditional approach is to load the data as a whole, and then
manipulate it from within Java. For example, if the output file is an
XML-file, use the Java routines to access its DOM.

Hope this helps,

That does help, thanks.

What do you mean by "load the data as a whole, and then manipulate it
from within Java" - are you saying that i can load the document in
java and then manipulate the javascript methods?

I read that you can build a java applet to access the javascript
within a page, but i dont want to go hacking around into someone's
webpage.

Thanks again
 
B

Bart Van der Donck

What do you mean by "load the data as a whole, and then manipulate it
from within Java" - are you saying that i can load the document in
java and then manipulate the javascript methods?

It depends on where & how the java program works. You said that it
runs from your desktop and fetches a remote resource over the
internet. In that case, the normal scenario would be to fire a GET/
POST request and receive the full response at that desktop application
(whatever format/output that may be).
I read that you can build a java applet to access the javascript
within a page, but i dont want to go hacking around into someone's
webpage.

Yes, but this is a considerably different situation. When the java
applet and the javascripts are in the same web page, they might
influence each other. I'm not a java sultan but i heard of the
MAYSCRIPT-argument for such applets.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top