alert()

Debug output from a PAC. Where it goes depends on the engine; remove it from production files.

alert(message)  →  undefined

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.

Example

alert("PAC evaluated for " + host); // remove before deploying

Engine notes

EngineBehaviourSource
chromiumForwarded to the net log (chrome://net-export).code, verified 2026-10-04
services/proxy_resolver/proxy_resolver_v8.cc AlertCallback
firefoxWritten to the browser console as "PAC-alert: ...".code, verified 2026-10-04
netwerk/base/ProxyAutoConfig.cpp@3f73c528 PACProxyAlert
pacparser1.5.1 and newer print to stderr.code, verified 2026-10-04
src/pacparser.c@v1.5.3 pac_alert
pacparser1.5.0 and older have no alert(), so calling it throws ReferenceError.doc, unverified
pacparser 1.5.1 release notes

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
alertyesyesyesnonoyesyes

Related rules