How to access the IP Address of the client machine using Java Script or VBScript
-
Hi Friends I am building an intranet site and want to access the IP Address or the domainname/ computer name of the client machine using javascript or vbscript. so if any one could help me i will be thankful.
Here's some script that should work :) ////////////////////////////////// //// Note ////////////////////////////////// <!-- For the NS version below, the end user must --> <!-- have java enabled in there browser --> ////////////////////////////////// <!-- Netscape Version --> if (navigator.appName=='Netscape' && navigator.javaEnabled()) { hn = java.net.InetAddress.getLocalHost().getHostName(); ha = java.net.InetAddress.getLocalHost().getHostAddress(); document.write('HostName: '+ hn + '<br>' + 'HostAddress: '+ ha ); } ////////////////////////////////// //// Note ////////////////////////////////// <!-- For the IE version below, it must be run on --> <!-- on a web server spporting ISS --> ////////////////////////////////// <!-- IE Version --> if (navigator.appName=='Microsoft Internet Explorer') { var ip = "<!--#echo var=\"REMOTE_ADDR\"-->"; document.write(ip) } Hope that helps. I tryed documenting it a little bit for ya, so beer with me :-D Later, Caleb
-
Here's some script that should work :) ////////////////////////////////// //// Note ////////////////////////////////// <!-- For the NS version below, the end user must --> <!-- have java enabled in there browser --> ////////////////////////////////// <!-- Netscape Version --> if (navigator.appName=='Netscape' && navigator.javaEnabled()) { hn = java.net.InetAddress.getLocalHost().getHostName(); ha = java.net.InetAddress.getLocalHost().getHostAddress(); document.write('HostName: '+ hn + '<br>' + 'HostAddress: '+ ha ); } ////////////////////////////////// //// Note ////////////////////////////////// <!-- For the IE version below, it must be run on --> <!-- on a web server spporting ISS --> ////////////////////////////////// <!-- IE Version --> if (navigator.appName=='Microsoft Internet Explorer') { var ip = "<!--#echo var=\"REMOTE_ADDR\"-->"; document.write(ip) } Hope that helps. I tryed documenting it a little bit for ya, so beer with me :-D Later, Caleb
Sorry, For the IE version you must have SSI installed. :) Later, Caleb