Is there a way to check whether the user has an internet connection?

If there is no internet connection I would like to show an error message

2 replies