#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Machine name, ip address , login username


    Hi Everybody,

    I have written the following java script code to get the machine name, Ip address and login user name.

    what the issues is,

    coding does support by IE 7 and 8. when i am using IE 9 IP address is not bringing.

    IE 10 totally not support. please help to clear it.

    the following is the script

    var wshNetwork =new ActiveXObject("WScript.Network");
    alert("domain ="+ wshNetwork.UserDomain);
    alert("machine name = "+ wshNetwork.ComputerName);
    alert("user name = "+ wshNetwork.UserName);


    var oSetting = null;
    var ip = null;
    try {
    oSetting = new ActiveXObject ("rcbdyctl.Setting");
    ip = oSetting.GetIPAddress;
    alert (ip);
    if (ip.length == 0) {
    return "is not connected to the Internet";
    } oSetting = null;
    }catch (e) {
    return ip;
    }
    return ip;
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    You cannot acquire a user's IP address with client side scripting. You will need to employ a server-side script to either print the IP to your client-side script, or via an AJAX call.
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.

IMN logo majestic logo threadwatch logo seochat tools logo