isPlainHostName()

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

isPlainHostName(host)  →  boolean

Used in about 58% of the real PAC files in the PAC file statistics.

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

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

EngineBehaviourSource
chromiumNative binding: true when the host has no dot and is not an IPv6 literal.lab, verified 2026-10-11
services/proxy_resolver/proxy_resolver_v8.cc
firefoxHelper library also returns false for names containing ':' (IPv6 literals).lab, verified 2026-10-11
netwerk/base/ascii_pac_utils.js@3f73c528
pacparserOnly checks for a dot, so isPlainHostName("::1") is true.lab, verified 2026-10-11
src/pac_utils.h@v1.5.3
winhttpTrue 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
Windows 11 25H2

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.1
winhttp
11-25H2
wininet
11-25H2
reference
all
isPlainHostNameyesyesyesyesyesyesyesyes

Related rules

Last updated: