On 25 mai, 16:34, Arne Vajh?j <a...@vajhoej.dk> wrote:
JCD wrote:
On 25 mai, 15:46, Arne Vajh?j <a...@vajhoej.dk> wrote:
JCD wrote:
On 25 mai, 15:33, Arne Vajh?j <a...@vajhoej.dk> wrote:
JCD wrote:
I'd like to get the result of a javascript method (executed in a web
browser) in a java application. Is it possible and how can I do it?
JSObject window = JSObject.getWindow(this);
window.eval("yourjsfunc()");
This code works with an applet but not with a java application, does
it?
That is correct.
If it is a standalone app then you need to use the method
described by Vivien.
Ok but with Viviens'method, I don't understand the link between the
function map.getCenter() wich is in my HTML page and his Java code.
Can you give me the exact code to evaluate map.getCenter() in my java
code, please?
I think you need to start by explaining how your Java app and
a web page is supposed to interact.
well, on the host computer, there is an html page containing a google
map and a java application that opens the web browser in a JPanel
(using the package jdic) . The URL of the web browser is set to the
HTML page which is on the hard disc. Then, the google map is displayed
and dragged with the mouse, and I want to get the new center
coordinates (wich I can calculate with the function map.getCenter() in
the HTML page) in the java application.
the package jdic allows to execute javascript in the HTML page (for
example browser.executeScript("map.setCenter(coordinates)");) but I
don't know how to have the result of the javascript function
map.getCenter(). Maybe I could use an applet but I'd like to know if
there is an easier method.- Masquer le texte des messages pr?c?dents -
the result of the javascript (if there's any) as a String.