Check if the computer is online. It does three tries:
Queries myip.opendns.com on OpenDNS, see my_ip().
my_ip()
Retrieves icanhazip.com via HTTPS, see my_ip().
Retrieve Apple's Captive Portal test page, see apple_captive_test(). If any of these are successful, it returns TRUE.
apple_captive_test()
TRUE
is_online(timeout = 1)
Timeout for the queries. (Note: it is currently not used for the DNS query.)
Possible values:
TRUE Yes, online.
FALSE No, not online.
FALSE
# NOT RUN { is_online() # }
Run the code above in your browser using DataLab