Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Find web page coordinates using java?

Thread view: 
Jimi Hullegård - 21 Nov 2005 01:05 GMT
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
Andrew Thompson - 21 Nov 2005 02:51 GMT
> 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

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Currently accepting short and long term contracts - on Earth.

jimi_usenet@hotmail.com - 21 Nov 2005 09:53 GMT
> > So, does anyone here know how to make JRex give me the coordinates? Or some
> > other solution or ideas?
[quoted text clipped - 6 lines]
> 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
Andrew Thompson - 21 Nov 2005 10:54 GMT
>>>So, does anyone here know how to make JRex give me the coordinates? Or some
>>>other solution or ideas?
[quoted text clipped - 8 lines]
> 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.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Currently accepting short and long term contracts - on Earth.

Jimi Hullegård - 21 Nov 2005 23:31 GMT
>>>>So, does anyone here know how to make JRex give me the coordinates? Or
>>>>some
[quoted text clipped - 12 lines]
> 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
Andrew Thompson - 24 Nov 2005 13:43 GMT
...
> 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. ]

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Currently accepting short and long term contracts - on Earth.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.