Re: How to communicate from HTML page with an IP which is not the web-server?



DavidNorep wrote:
As Daniel say, you can do it with AJAX:
* You send an XMLHTTP call to the server.
* A server-script do the connection to the external port you
want (Servers don't have the cross-domain security restriction).
* When the server script get the response from your external call,
it returns HTML or XML to your JavaScript in your original page.

Maybe I was not clear enough - I do not want that the communication
will pass through the HTTP server, but directly between the two home
computers. So I assume that XMLHTTPRequest is not a solution.

If you want to do it With an Applet, ...
So I want to do this in Java. I understand that you say that doing it
in Java means doing it with an applet, which may be invisible.

Just one point to be aware of:
If you call the (signed) Applet method that do the priviledged
task from a Javascript statement on the page, the method will
fail with a security exception. The JRE will notice that the call
came from a non-privilegded system (in this case JavaScript).

To walk around this, call a method in the Applet that only set
a flag, indicating that you want the method executed, and make
your Applet poll for this flag regularly.
I thought that the HTML page is loaded and then the init() method of
the applet is invoked. Can you invoke from Javascript any public
method in the applet?

Yes, You can...

Something like this:

if ( document.getElementById('yourAppletId') ) {
var myApplet = document.getElementById('yourAppletId');
myApplet.yourmethod();
}

--
Dag.
.



Relevant Pages

  • Re: interesting applet security problem
    ... the Javascript from host 1 ... can make the applet do basically anything the applet is allowed to do, ... like ipfw/ipchains/iptables or a small forwarding server). ...
    (comp.lang.java.security)
  • Re: IIS 6 & Server Permisions
    ... I am running a server side applett. ... link where I can find the correct changes to make in IIS6. ... is this Java application running on the Web Server or the Web Browser. ... where is the Applet trying to store the hit counters? ...
    (microsoft.public.inetserver.iis)
  • Applet Hangs when submitting data to servlet
    ... on our web server. ... applet that demonstrates the problem. ... private JButton theSubmitButton_, theClearButton_; ... public void actionPerformed ...
    (comp.lang.java.programmer)
  • Re: Applet Hangs when submitting data to servlet
    ... on our web server. ... applet that demonstrates the problem. ... private JButton theSubmitButton_, theClearButton_; ... public void actionPerformed ...
    (comp.lang.java.programmer)
  • Re: AJAX devtool using Cobol
    ... managed by a Java Applet. ... Server Affinity is completely under ... just enter an asterix "*" for the Queue Name and then click ... Applet Java code is application-neutral and completely reusable. ...
    (comp.lang.cobol)