Created
November 7, 2022 21:39
-
-
Save stokito/1e520d348fbe3ccc4d87c2a43b5d7f90 to your computer and use it in GitHub Desktop.
JavaScript resolve DNS from browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<script> | |
// https://stackoverflow.com/a/58299823/1049542 | |
// https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/make-api-requests/dns-json/ | |
// var dnsQ = fetch('https://dns.google/resolve?name=stokito.com&type=A', | |
var dnsQ = fetch('https://cloudflare-dns.com/dns-query?name=stokito.com&type=A', | |
{ | |
headers: { | |
'Accept': 'application/dns-json' | |
} | |
}) | |
dnsQ.then((response) => { | |
var l = response.json() | |
console.log(l) | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment