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>
How to Execute a JavaScript when the browser starts to work offline - HTML onoffline Attribute | HTML Attribute |
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |