Get Connection Status [JS1]

A JavaScript one-liner to find out if your device has connectivity


A single line of JavaScript to find out if your device has connectivity. This is less intrusive than other methods, like getting the IP address, and can be used, for example, before trying to download something.

Don't download the shortcut

If you just want the code, there's no need to download the shortcut. Copy this and paste it in a "URL" action:


Add a "Get File of Type" with type below, and its output will be the word "online" or "offline". If you prefer another output (e.g. a one instead of "online", and a zero instead of "offline") change the 'online':'offline' near the end of the line (e.g. by 1:0).

I use "Get File of Type" instead of "Get Contents of Webpage" to avoid that the user is misleading told that the shortcut uses Safari.

Latest Release Notes

1.0.0 - Sept. 30, 2020, 7:45 p.m.

First public version