How can I display a message if there's no internet connection?

I have a page which has lots of form inputs and I'm updating the data every time a field changes value so a long form can be completed in different sessions and it works perfectly. However, if there is a connection issue (some will be using mobiles where data might not always be available) they are updating a field but unaware that it didn't save.

The browser console shows there's no connection:

net::ERR_INTERNET_DISCONNECTED

but how can I show that on the page so they try again? I just want an alert to show saying 'internet connection lost, please try again'.

I thought it was going to be simple but now can't see how to go about it!

You can use the browser component to check if online or not:

1 Like

Genius! I knew it was a simple solution. Didn't think to check the Browser component.

Thanks @Teodor :slight_smile: