Find web page coordinates using java?

J

Jimi Hullegård

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
 
A

Andrew Thompson

Jimi said:
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
 
J

jimi_usenet

Andrew said:
<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
 
A

Andrew Thompson

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

Jimi Hullegård

Andrew Thompson said:
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
 
A

Andrew Thompson

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

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top