Check if online in Widget

I’d like to check if the device is online before rendering a widget. In vanilla JS I’d call navigator.online here. Is there a way to check for the connection in Scriptable? Thank you in advance!

you can still use that in a way

async function isOnline() {
  const wv = new WebView()
  let js ="navigator.onLine"
  let r = await wv.evaluateJavaScript(js)
  return r
}
2 Likes