isPlainHostName()
True if the host name contains no domain part (no dot), e.g. "intranet".
isPlainHostName(host) → booleanUse it on host, never on url (a URL always contains dots and slashes). It is the usual
first test for “single-label names go direct”. It does not resolve anything.
Example
if (isPlainHostName(host)) {
return "DIRECT";
}
pactester counts IPv6 addresses as plain host names, the browsers do not
An IPv6 address such as::1 has no dot. pactester (pacparser) therefore treats it as a plain
host name, while Chrome, Edge and Firefox do not. A rule that sends plain names direct then
behaves differently in a test and in the browser. Handle IPv6 addresses separately, as in
IPv6 in PAC files. Paste your file into the PAC file tester and switch between the Chromium, Firefox and pacparser profiles to see which answer each engine gives.Check how your own file behaves with the PAC file tester: switch the engine profile between Chromium, Firefox, pacparser and Windows and compare the trace. All engine differences are collected in pactester vs Chrome and Firefox.
Engine notes
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Native binding: true when the host has no dot and is not an IPv6 literal. | lab, verified 2026-10-11 |
| firefox | Helper library also returns false for names containing ':' (IPv6 literals). | lab, verified 2026-10-11 |
| pacparser | Only checks for a dot, so isPlainHostName("::1") is true. | lab, verified 2026-10-11 |
| winhttp | True for a name without a dot and for the empty string; false for "[::1]", "host:80" and IPv4 addresses. A call without an argument, with null or with two arguments raises an error that ends the script. | lab, verified 2026-10-11 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | winhttp | wininet | reference |
|---|---|---|---|---|---|---|---|---|
isPlainHostName | yes | yes | yes | yes | yes | yes | yes | yes |