Calling javascript functions from a java application

Discussion in 'Javascript' started by arun.hallan@gmail.com, Feb 15, 2008.

  1. Guest

    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
    , Feb 15, 2008
    #1
    1. Advertising

  2. wrote:

    > 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,

    --
    Bart
    Bart Van der Donck, Feb 15, 2008
    #2
    1. Advertising

  3. wrote:
    > 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
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
    Thomas 'PointedEars' Lahn, Feb 17, 2008
    #3
  4. Guest

    On Feb 15, 12:23 pm, Bart Van der Donck <> wrote:
    > wrote:
    > > 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,
    >
    > --
    >  Bart


    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
    , Feb 18, 2008
    #4
  5. wrote:

    > 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.

    --
    Bart
    Bart Van der Donck, Feb 19, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?WVI=?=
    Replies:
    4
    Views:
    2,879
    =?Utf-8?B?WVI=?=
    Jan 27, 2004
  2. Xiangliang Meng
    Replies:
    1
    Views:
    1,570
    Victor Bazarov
    Jun 21, 2004
  3. Daniel Vallstrom
    Replies:
    2
    Views:
    1,807
    Kevin Bracey
    Nov 21, 2003
  4. S?ren Gammelmark
    Replies:
    1
    Views:
    1,856
    Eric Sosman
    Jan 7, 2005
  5. Ross A. Finlayson
    Replies:
    19
    Views:
    568
    Keith Thompson
    Mar 10, 2005
Loading...

Share This Page