Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

closed as off topic by Su', Christofian Feb 28 '13 at 2:38

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  

1 Answer 1

up vote 0 down vote accepted

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.

share|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.