isLocalhost

Determines whether the specified IP address is the localhost.

isLocalhost(ipaddress) → returns boolean

isLocalhost Argument Reference

ipaddress String
Required

Valid IP address.

Compatibility

ColdFusion:

7

Links more information about isLocalhost

Examples sample code invoking the isLocalhost function


Is 127.0.0.1 localhost

isLocalHost("127.0.0.1")

Expected Result: YES


Is ::1 localhost

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

isLocalHost("::1")

Expected Result: YES


Is 127.8.8.8 localhost

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: NO


Is 8.8.8.8 localhost

Not a localhost ip.

isLocalHost("8.8.8.8")

Expected Result: NO


Fork me on GitHub