title: How to receive online/offline events in Javascript that's executed inside WKWebView on iOS?
body: <p>I have an iOS app that uses WKWebView to load in local HTML/JS file that contains <code>online</code>/<code>offline</code> event listeners but they aren't fired when user loses/regains connection. Same HTML/JS works on Android.</p>
  <p><code>offline</code> event - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/offline_event" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Window/offline_event</a>
  <code>online</code> event - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/online_event" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Window/online_event</a></p>
  <p>Is there something specific I need to configure for it to trigger those events?</p>
  <pre class="lang-js prettyprint-override"><code>window.addEventListener('online', () =&gt; {
      console.log('Regained internet connection');
  });
  
  window.addEventListener('offline', () =&gt; {
      console.log('Lost internet connection');
  });
  </code></pre>