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";
}
Engine notes
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Native binding: true when the host has no dot and is not an IPv6 literal. | code, verified 2026-10-04 |
| firefox | Helper library also returns false for names containing ':' (IPv6 literals). | code, verified 2026-10-04 |
| pacparser | Only checks for a dot, so isPlainHostName("::1") is true. | code, verified 2026-10-04 |