How to detect the Internet connection is offline in JavaScript?
I think it is a very simple way.
var x = confirm("Are you sure you want to submit?"); if (x) { if (navigator.onLine == true) { return true; } alert('Internet connection is lost'); return false; } return false;