Is there any way you can find the IP of the server that the browser is connected to? For e.g. if the browser is accessing http://www.google.com, can we tell in any way what IP it is connected to? This is very useful in cases where Round-robin DNS is implemented. So say, the first request to a.com
results in 1.1.1.1
& subsequent request result in 1.1.1.2
& so on.
I couldn't find any way to do it with JavaScript. Is it even possible? If not is there any universal way to find this info out?
I am sure the following code will help you to get ip address.
You cannot get this in general. From Javascript, you can only get the HTTP header, which may or may not have an IP address (typically only has the host name). Part of the browser's program is to abstract the TCP/IP address away and only allow you to deal with a host name.
Fairly certain this cannot be done. However you could use your preferred server-side language to print the server's IP to the client, and then use it however you like. For example, in PHP:
This depends on your server's security setup though - some may block this.