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?
1 Answer
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.
-
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– Salem874Commented Feb 27, 2013 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.– cjkCommented Feb 27, 2013 at 11:15
-
Thanks for pointing that out. I had totally missed that doh– Salem874Commented Feb 27, 2013 at 11:18