Horje

How to add a JavaScript when the browser changes from working offine to working online

Try to disconnect from the internet to toggle between working online and offline

index.html
Example: HTML

<!DOCTYPE html>
<html>
<body ononline="onFunction()" onoffline="offFunction()">
<p>Try to disconnect from the internet to toggle between working online and offline.</p>
<script>
function onFunction() { alert ("Your browser is working online.");
}
function offFunction() { alert ("Your browser is working offline.");
}
</script>
</body>
</html>

Output should be:

How to add a JavaScript when the browser changes from working offine to working online



Single Articles
Browsers Support of HTML ononline Event Attribute HTML Window Event Attributes
Syntax of HTML ononline Event Attribute HTML Window Event Attributes
Attribute Values of HTML ononline Event Attribute HTML Window Event Attributes
Technical Details of HTML ononline Event Attribute HTML Window Event Attributes
Example of HTML ononline Event Attribute HTML Window Event Attributes
How to add a JavaScript when the browser changes from working offine to working online HTML Window Event Attributes


Related Articles
HTML onafterprint Event Attribute HTML Window Event Attributes
HTML onbeforeprint Event Attribute HTML Window Event Attributes
HTML onbeforeunload Event Attribute HTML Window Event Attributes
HTML onerror Event Attribute HTML Window Event Attributes
HTML onhashchange Event Attribute HTML Window Event Attributes
HTML onload Event Attribute HTML Window Event Attributes
HTML onoffline Event Attribute HTML Window Event Attributes
HTML ononline Event Attribute HTML Window Event Attributes
HTML onpageshow Event Attribute HTML Window Event Attributes
HTML onresize Event Attribute HTML Window Event Attributes
HTML onunload Event Attribute HTML Window Event Attributes

Type :
html
Category :
Web Tutorial
Sub Category :
HTML Window Event Attributes
Uploaded by :
Admin