How to find out the server IP address (using JavaScript) that the browser is connected to?

前端 未结 10 2199
说谎
说谎 2020-12-29 04:20

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

10条回答
  •  一整个雨季
    2020-12-29 04:54

    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.

提交回复
热议问题