isLocalhost

Determines whether the specified value is the localhost.

isLocalhost(value) → returns boolean

Argument Reference

value string
Required

The value to check.

Links more information about isLocalhost

Examples
Sample code invoking the isLocalhost function

isLocalHost("127.0.0.1")

Expected Result: true

Test the IPv6 Loopback address. IPv6 only has one loopback address.

isLocalHost("::1")

Expected Result: true

IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback networking purposes however they are not usually mapped to localhost by default.

isLocalHost("127.8.8.8")

Expected Result: false

Not a localhost IP.

isLocalHost("8.8.8.8")

Expected Result: false

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub