SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript get ip

    Does anyone know of any javascript that will get the users ip address?

    I can do it in php, but want it done in javascript

    Thanks!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    You can not get a users IP address in JavaScript.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats what i thought, thanks for the reply

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You can combine JavaScript with some other language to get the IP address.

    See http://javascript.about.com/library/blip.htm for seven different pieces of JavaScript that can be used to load the visitor's IP address into a JavaScript variable depending on whether you want to use Java, SSI, PHP, ASP, .NET, JSP, or ColdFusion to pass the address into the JavaScript.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Trash Boat mkoenig's Avatar
    Join Date
    Aug 2007
    Posts
    1,232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    You can combine JavaScript with some other language to get the IP address.

    See http://javascript.about.com/library/blip.htm for seven different pieces of JavaScript that can be used to load the visitor's IP address into a JavaScript variable depending on whether you want to use Java, SSI, PHP, ASP, .NET, JSP, or ColdFusion to pass the address into the JavaScript.
    Thanks man, i have it in php, but im trying to keep everything client side to minimize server resources

    Thanks felgall


Bookmarks

Posting Permissions

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