Can I perform a DNS lookup (hostname to IP address) using client-side Javascript?

后端 未结 16 1712
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 11:45

I would like to use client-side Javascript to perform a DNS lookup (hostname to IP address) as seen from the client\'s computer. Is that possible?

16条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 12:01

    I am aware this is an old question but my solution may assist others.

    I find that the JSON(P) services which make this easy do not last forever but the following JavaScript works well for me at the time of writing.

    
    
    

    The above writes my server's IP on the page it is located but the script can be modified to find any IP by changing 'zero.eu.org' to another domain name. This can be seen in action on my page at: http://meon.zero.eu.org/

提交回复
热议问题