dnsDomainIs()
True if host ends with domain. A plain string suffix comparison, no DNS lookup.
dnsDomainIs(host, domain) → booleanBecause it is a plain suffix test, the domain must start with a dot: dnsDomainIs(host, "corp.example")
also matches evilcorp.example. Write dnsDomainIs(host, ".corp.example") and, if the apex
itself matters, add host == "corp.example".
Example
if (dnsDomainIs(host, ".corp.example") || host == "corp.example") {
return "DIRECT";
}
Engine notes
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Plain suffix comparison (host.length >= domain.length && host ends with domain). | code, verified 2026-10-04 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | pacparser | reference |
|---|---|---|---|---|---|---|---|
dnsDomainIs | yes | yes | yes | yes | yes | yes | yes |