CARVIEW |
Select Language
HTTP/2 301
content-length: 162
content-type: text/html
date: Wed, 15 Oct 2025 09:49:14 GMT
location: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dns/resolve
server: nginx
strict-transport-security: max-age=60; includeSubDomains
via: 1.1 google
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
HTTP/2 200
content-type: text/html
x-guploader-uploadid: AAwnv3JrsyonVosyYYEioeMdIfwclYHp_cC3hApUhd7kwAAvRqi7M-igFGxB3Tl89YQiAy-q
cache-control: public, max-age=3600
expires: Wed, 15 Oct 2025 10:49:15 GMT
last-modified: Wed, 15 Oct 2025 09:07:50 GMT
etag: W/"ae6441e40af309876a85e8e678a88152"
x-goog-generation: 1760519270324102
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 148112
x-goog-meta-goog-reserved-file-mtime: 1760518049
x-goog-hash: crc32c=oCqm5A==, md5=rmRB5ArzCYdqhejmeKiBUg==
x-goog-storage-class: STANDARD
accept-ranges: none
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
alt-svc: clear
referrer-policy: strict-origin-when-cross-origin
x-content-type-options: nosniff
strict-transport-security: max-age=63072000
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://www.googletagmanager.com/gtag/js assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net mdn.github.io live-samples.mdn.mozilla.net live-samples.mdn.allizom.net *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev interactive-examples.mdn.mozilla.net interactive-examples.mdn.allizom.net wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
x-frame-options: DENY
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-cloud-trace-context: 68147bbb56977b8d6c19d6eb17e820f2
date: Wed, 15 Oct 2025 09:49:15 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache: miss
dns.resolve() - Mozilla | MDN
Toggle sidebar
dns.resolve()
Resolves the given hostname to a DNS record.
This is an asynchronous function that returns a Promise
.
Syntax
js
let resolving = browser.dns.resolve(
hostname, // string
flags // array of string
)
Parameters
hostname
-
string
. The hostname to resolve. flags
Optional-
array
ofstring
. Flags to modify the way the hostname is resolved. Any omitted flags default tofalse
. You can pass zero or more of the following flags:"allow_name_collisions"
: Allow name collision results which are normally filtered out."bypass_cache"
: Suppresses the internal DNS lookup cache."canonical_name"
: The canonical name of the specified host will be queried."disable_ipv4"
: Only IPv6 addresses will be returned."disable_ipv6"
: Only IPv4 addresses will be returned."disable_trr"
: Do not use the Trusted Recursive Resolver (TRR) for resolving the host name. A TRR enables resolving of host names using a dedicated DNS-over-HTTPS server."offline"
: Only literals and cached entries will be returned."priority_low"
: The request is given lower priority. If "priority_medium" is also given, the query is given medium priority."priority_medium"
: The request is given medium priority. If "priority_low" is also given, the query is given medium priority."speculate"
: Indicates that the request is speculative. Speculative requests return errors if prefetching is disabled by the browser's configuration.
Return value
A Promise
that will be fulfilled with a DNSRecord
object. This object can contain the following properties:
addresses
-
array
ofstring
. The IP addresses associated with this DNS record. canonicalName
-
string
. The canonical name for this record. This is only included in the response if the"canonical_name"
flag was passed toresolve()
. isTRR
-
boolean
:true
if the record was retrieved using a Trusted Recursive Resolver (TRR).
Examples
js
function resolved(record) {
console.log(record.addresses);
}
let resolving = browser.dns.resolve("example.com");
resolving.then(resolved);
// > e.g. Array [ "192.0.2.172" ]
Bypass the cache, and ask for the canonical name:
js
function resolved(record) {
console.log(record.canonicalName);
console.log(record.addresses);
}
let resolving = browser.dns.resolve("developer.mozilla.org", [
"bypass_cache",
"canonical_name",
]);
resolving.then(resolved);
// > e.g. xyz.us-west-2.elb.amazonaws.com
// > e.g. Array [ "192.0.2.172", "198.51.100.45" ]
Browser compatibility
Loading…