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

前端 未结 10 2228
说谎
说谎 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:44

    Not sure how to get the IP address specifically, but the location object provides part of the answer.

    e.g. these variables might be helpful:

    • self.location.host - Sets or retrieves the hostname and port number of the location
    • self.location.hostname - Sets or retrieves the host name part of the location or URL.

提交回复
热议问题