D
D
dollar2018-09-21 16:44:01
JavaScript
dollar, 2018-09-21 16:44:01

Is there a way to implement nslookup using JS from a Chrome extension?

That is, the domain is known - example.com.
You need to get all its ip-addresses using only the browser's DNS resolver.
I know that you can create an external site, and turn to it for help. But what is interesting is the native way using JavaScript to obtain an ip-address.
Something like this: Ideally, no additional rights should be requested from Chrome by the extension, such as intercepting the contents of pages ("webRequest").
getIP("example.com")[0] //93.184.216.34

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2018-10-03
@dollar

chrome.webRequest.onCompleted.addListener(function(d) {
  console.log(d.ip, d.url);
}, {'urls' : ["<all_urls>"], 'types' : ['main_frame']});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question