localHostOrDomainIs()
True if host equals hostdom exactly, or host is the unqualified first label of hostdom.
localHostOrDomainIs(host, hostdom) → booleanlocalHostOrDomainIs("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
| Engine | Behaviour | Source |
|---|---|---|
| winhttp | Ignores 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 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | winhttp | wininet | reference |
|---|---|---|---|---|---|---|---|---|
localHostOrDomainIs | yes | yes | yes | yes | yes | yes | yes | yes |