Javascript examples for DOM Event:Element Event Attribute
The onoffline event occurs when the browser starts to work offline.
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <body> |
<!DOCTYPE html> <html> <body> <script> document.getElementsByTagName("BODY")[0].ononline = function() {onFunction()}; document.getElementsByTagName("BODY")[0].onoffline = function() {offFunction()}; function onFunction() {/*from ww w . jav a2s .c om*/ console.log("Your browser is working online."); } function offFunction() { console.log("Your browser is working offline."); } </script> </body> </html>