Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Is there a way to get ones IP and host locally?

    I am putting together a local info script for a user to see all their browsers vital's in a little window, though I am not able to get IP and host to work right, is this not possible or am I using the wrong commands/syntax? I was using a document.write with similar to ('..IP: '+%%IP%%+'..Host info: '+%%HOST%%+'.. .') So, far all I have managed to do is get it to display the literal var I have been trying to grab this info from. If theres a way plz let me know how, thx!

    Also is there a way to tell Windows XP from Just Windows? I have tried XP, WinXP, Windows XP, none have worked out so far...

  • #2
    Regular Coder DELOCH's Avatar
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    537
    Thanks
    4
    Thanked 2 Times in 2 Posts
    no, getting IP using javascript-clientside is impossible, to accomplish this task get IIS/PWS and use ASP with Javascript, because IP is what server is able to get not client

    so I am sorry but the answer to this question is no, only a server-side script and programs can get your Internet protocol(such as ASP, PHP, PERL, and JSP)

    so hope it helps

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Here's an old function. I don't think it works on IE and probably won't fly in most other browsers based on the security config.

    Code:
    function test(){
      vartool=java.awt.Toolkit.getDefaultToolkit();
      addr=java.net.InetAddress.getLocalHost();
      host=addr.getHostName();
      ip=addr.getHostAddress();
      alert(ip);
      alert(host);
    }

  • #4
    Regular Coder DELOCH's Avatar
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    537
    Thanks
    4
    Thanked 2 Times in 2 Posts
    looks like java to me, anyways, like i said, use a server-side script

  • #5
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Yea it figures, thanks for the help.

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,465
    Thanks
    0
    Thanked 634 Times in 624 Posts
    That is actually Javascript that is calling Java to get the IP address.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •