1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How can i trace ip address through javascript?

Discussion in 'JavaScript' started by ravianz, Oct 30, 2005.

  1. #1
    hi!
    can anyone please tell me if there is some code or statement to trace the ip address of visitors using Javascript;
    ravianz, Oct 30, 2005 IP
  2. ServerUnion

    ServerUnion Peon

    Messages:
    3,615
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    0
  3. cyclinder

    cyclinder Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    this is impossible but you can do this via Java and flash actionscript communication
    cyclinder, Nov 25, 2005 IP
  4. Sushi_Master

    Sushi_Master Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sushi_Master, Nov 25, 2005 IP
  5. vishwaa

    vishwaa Peon

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    vishwaa, Nov 25, 2005 IP
  6. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You might want to use a server-side language which is easier. Not a function for a JAvascript

    Like PHP, you would use <?php echo $_SERVER['REMOTE_ADDR']; ?>
    To trace you might want to add it to a Database.
    execute, Nov 25, 2005 IP
  7. ServerUnion

    ServerUnion Peon

    Messages:
    3,615
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    0
    #7
    you can have the user view IP by:

    <SCRIPT>
    var ip = new java.net.InetAddress.getLocalHost();
    var ipStr = new java.lang.String(ip);
    document.writeln(ipStr.substring(ipStr.indexOf("/")+1));
    </SCRIPT>

    Although this wont help you track as much, you may store that info in a cookie for the next time they return. As others mentioned, best way is to use one of the many server side programing languages.

    Good luck...
    ServerUnion, Nov 28, 2005 IP
  8. NetDefender

    NetDefender Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hey i 2 am findin a code 2 write 4 an iptracer 4 my proj.:)
    NetDefender, Jan 24, 2010 IP
  9. Vinil Mehta

    Vinil Mehta Member

    Messages:
    189
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #9
    other than this is there any code that seems helpful?
    Vinil Mehta, Aug 11, 2011 IP
  10. astrazone

    astrazone Member

    Messages:
    358
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #10
    astrazone, Aug 11, 2011 IP
  11. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    3
    Best Answers:
    7
    Trophy Points:
    0
    #11
    JavaScript alone will not give you the IP Address of the visitor, you need a help of server-side scripting.
    JohnnySchultz, Aug 12, 2011 IP
  12. Vinil Mehta

    Vinil Mehta Member

    Messages:
    189
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #12
    what should be done exactly .?
    Vinil Mehta, Aug 18, 2011 IP
  13. rajmv

    rajmv Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    index.php:
    Code (Text):
    1.  
    2. <html>
    3. <head>
    4.   <script type="text/javascript" src="get_ip.js.php"></script>
    5. </head>
    6. <body onload="displayIP();">
    7.   <div id="usersIP"></div>
    8. </body>
    9. </html>
    10.  
    get_ip.js.php:
    Code (Text):
    1.  
    2. function displayIP() {
    3.   document.getElementById('usersIP').innerHTML = "Your IP is <?php echo $_SERVER['REMOTE_ADDR']?>";
    4. }
    5.  
    rajmv, Aug 20, 2011 IP
  14. dkphp

    dkphp Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    this one is what you looking for

    easyjquery(.)com/detect-get-clients-ip-address-country-using-javascript-php/
    dkphp, Apr 2, 2012 IP
  15. goldenpro

    goldenpro Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #15
    not working with me :( I hope find out the way did in this site stuffgate(.)com ??
    goldenpro, Sep 20, 2013 IP
  16. ketting00

    ketting00 Active Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #16
    Done through node.js module. This is pretty easy.
    ketting00, Oct 6, 2013 IP