dnsDomainLevels()
Number of dots in the host name ("www.corp.example" gives 2).
dnsDomainLevels(host) → numberCounts dots, so it also counts them in IP literals: dnsDomainLevels("10.1.2.3") is 3.
Example
if (dnsDomainLevels(host) == 0) {
return "DIRECT";
}
Engine notes
| Engine | Behaviour | Source |
|---|---|---|
| winhttp | Counts dots like the other engines: "www" gives 0, "www.example.com" 2 and "example.com." 2. | lab, verified 2026-10-11 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | winhttp | wininet | reference |
|---|---|---|---|---|---|---|---|---|
dnsDomainLevels | yes | yes | yes | yes | yes | yes | yes | yes |