# PAC function reference

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

The functions a PAC file can call, what they really do, and which engines provide them. Availability is derived from the engines' own helper libraries, not from documentation.




- [alert()](https://findproxyforurl.net/functions/alert/index.md): Not part of the original Netscape API. Engines log it somewhere (or not at all), and an engine without it throws a ReferenceError, which turns the whole evaluation into an error.

- [dateRange()](https://findproxyforurl.net/functions/daterange/index.md): Accepts many argument forms (day, month, year, or ranges of them). Local time unless “GMT” is the last argument.

- [dnsDomainIs()](https://findproxyforurl.net/functions/dnsdomainis/index.md): Because it is a plain suffix test, the domain must start with a dot: dnsDomainIs(host, "corp.example") also matches evilcorp.example. Write dnsDomainIs(host, ".corp.example") and, if the apex itself matters, add host == "corp.example".

- [dnsDomainLevels()](https://findproxyforurl.net/functions/dnsdomainlevels/index.md): Counts dots, so it also counts them in IP literals: dnsDomainLevels("10.1.2.3") is 3.

- [dnsResolve()](https://findproxyforurl.net/functions/dnsresolve/index.md): Only the first call for a name sends a DNS query. Later calls for the same name, in the same run or in later requests, are answered from a cache until the stored answer expires (see DNS in PAC files). Calling it once and keeping the result in a local variable is still right: Windows keeps nothing between the calls of one run, so with a DNS server that does not answer every call waits again, and pactester asks the DNS server for every call.

- [dnsResolveEx()](https://findproxyforurl.net/functions/dnsresolveex/index.md): Only available in engines that implement the Microsoft “Ex” extensions. Firefox does not, so a PAC that calls it there fails with a ReferenceError.
In Chrome and Edge, dnsResolve (IPv4 only) and dnsResolveEx (all addresses) for the same name are two different questions with two cache entries, so using both costs two lookups. Use one of them per name and keep the result in a variable.

- [isInNet()](https://findproxyforurl.net/functions/isinnet/index.md): Pattern and mask are dotted IPv4 strings: isInNet(host, "10.0.0.0", "255.0.0.0"). When host is a name, the engine first resolves it and the script waits for the answer. Only the first call for a name sends a DNS query; repeats are answered from a cache, so ten calls for one name are not ten queries. The cost comes from different names and from a DNS server that does not answer (see DNS in PAC files). When host is already an IP address, nothing is looked up. Guard the call with an IP-address test such as /^\d+\.\d+\.\d+\.\d+$/.test(host) if you only want to match addresses written in the URL.

- [isInNetEx()](https://findproxyforurl.net/functions/isinnetex/index.md): Takes a CIDR prefix instead of a mask. Only in engines with the “Ex” extensions.

- [isPlainHostName()](https://findproxyforurl.net/functions/isplainhostname/index.md): 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.

- [isResolvable()](https://findproxyforurl.net/functions/isresolvable/index.md): The first call for a name sends a DNS query; later calls for the same name are answered from a cache until the stored answer expires (see DNS in PAC files). Used as an “am I on the internal network?” check, it still makes every request depend on DNS: outside the company network the internal DNS server cannot be reached, and each request waits for a timeout. Where DNS is split, the answer is simply wrong.

- [isResolvableEx()](https://findproxyforurl.net/functions/isresolvableex/index.md): Only in engines with the “Ex” extensions.

- [localHostOrDomainIs()](https://findproxyforurl.net/functions/localhostordomainis/index.md): localHostOrDomainIs("www", "www.corp.example") and localHostOrDomainIs("www.corp.example", "www.corp.example") are true; localHostOrDomainIs("www.other.example", "www.corp.example") is false. Rarely needed in modern PACs.

- [myIpAddress()](https://findproxyforurl.net/functions/myipaddress/index.md): A computer usually has several addresses: one per network adapter, VPN adapters, virtual adapters and IPv6 addresses. myIpAddress() returns only one of them, and each engine chooses it by its own rule. Chrome, Edge and Firefox look at the route towards the internet. Windows’ own proxy engine looks at the interface metric, which is the order of the adapters in Windows. pactester looks at the computer’s name. The answer can also change while the computer runs: when a VPN connects, when Wi-Fi and cable are both in use, or when Windows stops using a gateway that does not answer.

- [myIpAddressEx()](https://findproxyforurl.net/functions/myipaddressex/index.md): Only in engines with the “Ex” extensions (see the availability table). The list differs a lot between engines, so treat it as a list of strings in an unknown format.

- [shExpMatch()](https://findproxyforurl.net/functions/shexpmatch/index.md): Chromium, Firefox and pacparser convert the glob into a regular expression. * also matches dots, so shExpMatch(host, "*example.com") matches notexample.com; use "*.example.com". Matching on url instead of host lets a query string such as ?r=example.com trigger the rule.

- [sortIpAddressList()](https://findproxyforurl.net/functions/sortipaddresslist/index.md): Only in engines that bind it natively (see the availability table).

- [timeRange()](https://findproxyforurl.net/functions/timerange/index.md): Local time unless “GMT” is passed. The checker evaluates time functions at a fixed “now” you can set, so results are reproducible.

- [weekdayRange()](https://findproxyforurl.net/functions/weekdayrange/index.md): Time-dependent PACs are hard to test and behave differently per engine; the checker evaluates them at a fixed “now” so results are reproducible.

