Is it possible to get a visitor/requester public (WAN/external) IP address with pure Javascript? IE. without the use of additional JS libraries like jQuery? If so, how?


Javascript runs on the client, which may have multiple network conenctions, which may be behind firewalls and NATs. You will only be able to retrieve the IP address once the connection has been made outside of the network.

You could call a service that just bounces back the IP address, but this requires having the service and bandwidth set up.

| improve this answer | |
  • Thanks for the prompt response. That does make sense actually. I hadnt thought about that. I'm sure I should be able to create something that can "bounce back" the IP. Thanks again – Salem874 Feb 27 '13 at 11:13
  • @LanceRileyManasse - the comment on your question has a number of sites that will already do it, however you'll have to be careful of the number if hits you are sending. – cjk Feb 27 '13 at 11:15
  • Thanks for pointing that out. I had totally missed that doh – Salem874 Feb 27 '13 at 11:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.