PDA

View Full Version : IP address using javascript


meterlink
07-15-2002, 08:19 PM
Hi,
How can I get IP address of the client using javascript in IE and NS ?

Thank you very much

scroots
07-15-2002, 09:12 PM
this is in the wrong topic area, look on www.javascriptkit.com under cut and paste scripts for one.

scroots

ACJavascript
07-16-2002, 12:40 AM
i don't think you can get a IP address using javascript. You need to use a server-side language like CGI.

glenngv
07-16-2002, 08:11 AM
it's possible but in NS only.

<script>
if (navigator.javaEnabled()&&(document.layers||(document.getElementById&&!document.all))) {
myAddress=java.net.InetAddress.getLocalHost();
host=myAddress.getHostName();
ip=myAddress.getHostAddress();
alert(host+" = "+ip);
}
</script>


Originally posted by ACJavascript
i don't think you can get a IP address using javascript. You need to use a server-side language like CGI.

Zvona
07-16-2002, 09:26 AM
Maybe I should make a sticky thread, but :

When you're problem is about scripting, it should be posted to an appropriate scripting forum
When you're problem is about mark-up, structure, presentation or layout, it should be posted to HTML&CSS
On other issues, try General Web Building forum