no internet connection html code code example
Example 1: no internet connection html page
window.addEventListener("online", function() {
alert("You are online now!");
});
window.addEventListener("offline", function() {
alert("Oops! You are offline now!");
});
Example 2: no internet connection html page
if (navigator.onLine) {
console.log("You are online");
} else {
console.log("You are offline");
}