Find web page coordinates using java?

Discussion in 'Java' started by Jimi Hullegård, Nov 21, 2005.

  1. Hi

    Does anyone of you know of a java webbrowser plugin/component that gives me
    access to the coordinates of elements in a rendered page?
    I want to draw some real time animation on top of an html page, using the
    coordinates of some of the links.
    Not server side, but client side. And not using javascript or flash. So I'm
    thinking either an applet, or a standalone java application with some
    broswer plugin that makes it act like a regular browser.

    I have tried JRex (http://jrex.mozdev.org/), and according to the API there
    is a method that will give the coordinates of an anchor
    (http://jrex.mozdev.org/docs/api/org/w3c/dom/html2/HTMLAnchorElement.html)
    but that method returns an empty string. I have asked about this in the jrex
    news group and mailing list, but no one has answered.

    So, does anyone here know how to make JRex give me the coordinates? Or some
    other solution or ideas?

    Regards
    /Jimi
    Jimi Hullegård, Nov 21, 2005
    #1
    1. Advertising

  2. Jimi Hullegård wrote:

    > So, does anyone here know how to make JRex give me the coordinates? Or some
    > other solution or ideas?


    <requires the user to run it in 'trusted' mode>
    Frame the page you ultimately want in a frameset
    where there is a hidden frame containing an applet
    and JS of your devising. The JS determines the mouse
    position and hands it to the applet, the applet
    communicates that back to ..whatever needs to know.
    <requires the user to run it in 'trusted' mode>

    HTH

    --
    Andrew Thompson
    physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
    Currently accepting short and long term contracts - on Earth.
    Andrew Thompson, Nov 21, 2005
    #2
    1. Advertising

  3. Jimi Hullegård

    Guest

    Andrew Thompson wrote:
    > Jimi Hullegård wrote:
    >
    > > So, does anyone here know how to make JRex give me the coordinates? Or some
    > > other solution or ideas?

    >
    > <requires the user to run it in 'trusted' mode>
    > Frame the page you ultimately want in a frameset
    > where there is a hidden frame containing an applet
    > and JS of your devising. The JS determines the mouse
    > position and hands it to the applet, the applet
    > communicates that back to ..whatever needs to know.
    > <requires the user to run it in 'trusted' mode>


    Sorry, I think I maybe was unclear. I need the coordinates of the
    anchor elements on the rendered html page, not the mouse coordinates

    /Jimi
    , Nov 21, 2005
    #3
  4. wrote:

    > Andrew Thompson wrote:
    >
    >>Jimi Hullegård wrote:
    >>
    >>
    >>>So, does anyone here know how to make JRex give me the coordinates? Or some
    >>>other solution or ideas?

    >>
    >><requires the user to run it in 'trusted' mode>
    >>Frame the page you ultimately want in a frameset
    >>where there is a hidden frame containing an applet
    >>and JS of your devising. The JS determines the mouse
    >>position and hands it to the applet, the applet
    >>communicates that back to ..whatever needs to know.

    >
    > Sorry, I think I maybe was unclear. I need the coordinates of the
    > anchor elements on the rendered html page, not the mouse coordinates


    AFAIU, JS can navigate the page DOM and give you co-ords
    of each of the page elements, as well.

    --
    Andrew Thompson
    physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
    Currently accepting short and long term contracts - on Earth.
    Andrew Thompson, Nov 21, 2005
    #4
  5. "Andrew Thompson" <> wrote in message
    news:dHhgf.23264$...
    > wrote:
    >
    >> Andrew Thompson wrote:
    >>
    >>>Jimi Hullegård wrote:
    >>>
    >>>
    >>>>So, does anyone here know how to make JRex give me the coordinates? Or
    >>>>some
    >>>>other solution or ideas?
    >>>
    >>><requires the user to run it in 'trusted' mode>
    >>>Frame the page you ultimately want in a frameset
    >>>where there is a hidden frame containing an applet
    >>>and JS of your devising. The JS determines the mouse
    >>>position and hands it to the applet, the applet
    >>>communicates that back to ..whatever needs to know.

    >>
    >> Sorry, I think I maybe was unclear. I need the coordinates of the
    >> anchor elements on the rendered html page, not the mouse coordinates

    >
    > AFAIU, JS can navigate the page DOM and give you co-ords
    > of each of the page elements, as well.


    Thanks for the tip. I looked into that, and found a good page about that
    (http://webdeveloper.com/advhtml/ " Determining Element Page Coordinates").

    So now I have a javascript that gives me the information I need. But I can't
    seem to figure out how to use this javascript with JRex. I have read about
    the JSObject, but all I see is examples on how to call javascript functions
    that are already "in" the html page. But my javascript is in a separate
    js-file. How do I "insert" that file into the html page, so I then can call
    my own methods on that page? I don't want to have to edit the html-page.

    Regards
    /Jimi
    Jimi Hullegård, Nov 21, 2005
    #5
  6. Jimi Hullegård wrote:
    ....
    > So now I have a javascript that gives me the information I need. But I can't
    > seem to figure out how to use this javascript with JRex. I have read about
    > the JSObject, but all I see is examples on how to call javascript functions
    > that are already "in" the html page. But my javascript is in a separate
    > js-file. How do I "insert" that file into the html page, so I then can call
    > my own methods on that page? I don't want to have to edit the html-page.


    You need to introduce the JS into the HTML somehow,
    You can use a single line reference to the file containing
    the JS, or if the tarrget oage is beyond being edited, you need
    to use the frames based approach I mentioned earlier, and inport
    the JS into another frame in that frameset.

    [ But see the comp.lang.javasrcipt people for the details. ]

    --
    Andrew Thompson
    physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
    Currently accepting short and long term contracts - on Earth.
    Andrew Thompson, Nov 24, 2005
    #6
    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. martin
    Replies:
    1
    Views:
    610
  2. Suresh  Kumar
    Replies:
    0
    Views:
    579
    Suresh Kumar
    Jul 3, 2003
  3. Suresh  Kumar
    Replies:
    0
    Views:
    507
    Suresh Kumar
    Jul 4, 2003
  4. Vladimir Eltchinov

    How to find out iframe's coordinates in parent?

    Vladimir Eltchinov, Aug 20, 2003, in forum: Javascript
    Replies:
    0
    Views:
    109
    Vladimir Eltchinov
    Aug 20, 2003
  5. Replies:
    26
    Views:
    259
    Laurent Bugnion
    Aug 24, 2006
Loading...

Share This Page