dnsDomainLevels()

Number of dots in the host name ("www.corp.example" gives 2).

dnsDomainLevels(host)  →  number

Used in about 1% of the real PAC files in the PAC file statistics.

Counts 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

EngineBehaviourSource
winhttpCounts dots like the other engines: "www" gives 0, "www.example.com" 2 and "example.com." 2.lab, verified 2026-10-11
Windows 11 25H2

Availability

Derived from each engine's vendored helper library plus its native bindings (see engines).
Functionchromium
<=51
chromium
>=52
firefox
all
pacparser
<=1.4.6
pacparser
>=1.5.1
winhttp
11-25H2
wininet
11-25H2
reference
all
dnsDomainLevelsyesyesyesyesyesyesyesyes

Related rules

Last updated: