views:

1592

answers:

3

Is it possible using only JavaScript to obtain the user's IP Address? If so, how?

+1  A: 

I don't think so. You'll need to use a server side language. Or find a service maybe you could use with AJAX, but I'm not sure if one exists.

alex
A: 

No. It is strictly client-side so it will use some secondary technology to find the IP Address.

A google search provides many options.

Paulo
You mind giving an example of this secondary service. Also, how would that work since that would then mean *my* web server would be forwarding the request ... so the secondary service would simply return the IP address of my web server and not the clients browser
I actually said 'secondary technology' such as PHP or .NET which will run on your server. Your question specifically asked if you could use ONLY javascript, which you can't. You will need to have a server-side script provide you with that info. If you are using the Prototype or jQuery then you can perform AJAX requests with ease and return the value you want. For more information I suggest any of the related SO questions above or refer to http://javascript.about.com/library/blip.htm which outlines how to do it with Java, PHP, ASP, .NET, and CF
Paulo
A: 

What about using one of those online services that tell you the IP address of the requestor. I've only seen them in the context of a html view. But my idea is that you make some request, and the response would contain the ip info (in some crude way).

Irwin