localHostOrDomainIs()

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

localHostOrDomainIs(host, hostdom)  →  boolean

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";
}

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.0
pacparser
>=1.5.1
reference
all
localHostOrDomainIsyesyesyesyesyesyesyes