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

后端 未结 16 1785
没有蜡笔的小新
没有蜡笔的小新 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:05

    Edit: This question gave me an itch, so I put up a JSONP webservice on Google App Engine that returns the clients ip address. Usage:

    
    
    
    

    Yay, no server proxies needed.


    Pure JS can't. If you have a server script under the same domain that prints it out you could send a XMLHttpRequest to read it.

提交回复
热议问题