# isPlainHostName()

Source: https://findproxyforurl.net/functions/isplainhostname/ · last updated 2026-10-11

`isPlainHostName(host)` → boolean

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

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

```js
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](https://findproxyforurl.net/articles/ipv6-in-pac-files/). Paste your file into the [PAC file tester](https://findproxyforurl.net/check/) and switch between the Chromium, Firefox and pacparser profiles to see which answer each engine gives.


## Engine notes

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