Search code examples
javascriptjqueryxmlhttprequest

XMLHttp​Request get ip of url


For example i send a request to https://www.w3schools.com/ which is showed Remote Address: 192.229.179.87:443 on Inspect tools, can i get that ip in js?


Solution

  • An IP address or Internet Protocol is used in hand with TCP(Transmission control protocol) to identify and share information between computers on the internet. Because it would be a very hard job for humans to keep IP's of various servers in the head, all IP addresses are saved on a DNS server together with their domain names. Hence, whenever you make a request to a site in your web browser, the web browser first visits a DNS server to fetch the IP address corresponding to your domain before making a direct request to the server. Hence there is no Javascript code or command to generate IP addresses from domain names. Hence to accomplish this, you'll have to use an API which will do all the hard work for you.

    Check this question for some API's : API's for getting IP