localHostOrDomainIs()

True if host equals hostdom exactly, or host is the unqualified first label of hostdom.

localHostOrDomainIs(host, hostdom)  →  boolean

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

localHostOrDomainIs("www", "www.corp.example") and localHostOrDomainIs("www.corp.example", "www.corp.example") are true; localHostOrDomainIs("www.other.example", "www.corp.example") is false. Rarely needed in modern PACs.

Example

if (localHostOrDomainIs(host, "intranet.corp.example")) {
  return "DIRECT";
}

Engine notes

EngineBehaviourSource
winhttpIgnores case: localHostOrDomainIs("WWW", "www.example.com") is true. A host that contains a dot must equal hostdom: localHostOrDomainIs("www.example", "www.example.com") is false.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
localHostOrDomainIsyesyesyesyesyesyesyesyes

Related rules

Last updated: