![]() |
Definition and UsageThe onoffline attribute fires when the browser starts to work offline. Tip: The onoffline attribute is the opposite of the ononline attribute. Applies toThe onoffline attribute is part of the Event Attributes, and can be used on the following element:
|
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>
html onoffline attribute |
How to Execute a JavaScript when the browser starts to work offline - HTML onoffline Attribute | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 65 |
Reffered: https://www.w3schools.com/tags/att_onoffline.asp