Edit This Code:
<!DOCTYPE html>
<html>
<body ononline="onFunction()" onoffline="offFunction()">

<p>Open the File menu and click on "Work Offline" to toggle between working online and offline.</p>

<p><strong>Note:</strong> The ononline and onoffline events are only supported in Firefox and Internet Explorer version 8 to 10.</p>

<script>
function onFunction() {
    alert ("Your browser is working online.");
}

function offFunction() {
    alert ("Your browser is working offline.");
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy