isPlainHostName()

True if the host name contains no domain part (no dot), e.g. "intranet".

isPlainHostName(host)  →  boolean

Use 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

EngineBehaviourSource
chromiumNative binding: true when the host has no dot and is not an IPv6 literal.code, verified 2026-10-04
services/proxy_resolver/proxy_resolver_v8.cc
firefoxHelper library also returns false for names containing ':' (IPv6 literals).code, verified 2026-10-04
netwerk/base/ascii_pac_utils.js@3f73c528
pacparserOnly checks for a dot, so isPlainHostName("::1") is true.code, verified 2026-10-04
src/pac_utils.h@v1.5.3

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
isPlainHostNameyesyesyesyesyesyesyes