function determines whether a device has access to the Internet. If called with no arguments, then the function determines whether the device can connect to the Internet via Wi-Fi or via a mobile network like 3G, 4G, or GPRS. Optional arguments (WiFi
) allow you to determine if a given connection is valid on mobile CSEntry. On desktop CSEntry, the optional arguments are ignored and the function returns whether a connection can be made via a LAN, a Wi-Fi connection, or a mobile network connection.
The function returns a logical value of 1 (true) if a connection exists and 0 (false) otherwise. The presence of a connection does not guarantee access to the Internet, however. For example, a device could be connected to a Wi-Fi router that does not have an Internet connection. The function would still return 1 in that case.