Hi Neng,
On Tue, Sep 2, 2008 at 1:49 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
[cut]
>> Now I found the solution of you problem is to add js into web page, sample
>> as below:
>> var body = document.body;
>> var ip = document.createElement('script');
>> ip.setAttribute('type','text/javascript');
>> ip.innerHTML = 'var ip = new java.net.InetAddress.getLocalHost();alert(ip);'
>> body.insertBefore(ip,body.firstChild);
>
> I'm trying that now !
> anyway java.net.InetAddress.getLocalHost() turns back the loopback
> address (i.e. 127.0.0.1)
> but what I need is the local address of my network interface (e.g.
> 192.168.1.XX)... that's
> why on my original code I use the trick that involve opening a socket
> to a known hostname
> (note that you need to grant permission to this kind of operation in
> your java.policy )
it works! I can confirm java.net.InetAddress.getLocalHost() gives back
"loopback/127.0.0.1"
whereas
java.net.Socket("www.opinioni.net",80).getLocalAddress().getHostAddress()
returns what
I need, the IP address of my local network adapter
thanks you again
Andrea
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---