Copied successfully!
HTML onoffline Event Attributes
The onofflineHTML event attribute is a specialized feature in web development that is triggered when a user's device loses internet connectivity. It is part of the online and offline events suite provided by the HTML5 standard to help developers build robust, connectivity-aware applications. This event is commonly used to enhance user experience by detecting and handling offline scenarios gracefully.
Defining HTML onoffline Event Attributes
The onofflineevent is fired on the window object whenever the browser detects a transition from an online to an offline state. It enables developers to monitor the connectivity status of the user's device in real-time and take appropriate actions, such as disabling online features or displaying a notification about the offline state.
This event is closely related to the ononline event, which triggers when the device regains connectivity.
Window Event Attributes
Attributes | Description |
---|---|
onafterprint | Fires after the document has started printing or the print dialog box has been closed. |
onbeforeprint | Fires before the document is about to be printed. |
onbeforeunload | Fires when the document is about to be unloaded. |
onerror | Fires when an error occurs during loading of an external file (e.g., images or scripts). |
onhashchange | Fires when the anchor part of the URL has changed. |
onload | Fires when the page has finished loading. |
onmessage | Fires when a message is received through an event source (e.g., WebSocket or iframe). |
onoffline | Fires when the browser starts working offline. |
ononline | Fires when the browser starts working online. |
onpagehide | Fires when the user navigates away from a webpage. |
onpageshow | Fires when the user navigates to a webpage. |
onpopstate | Fires when the active history entry changes (e.g., when the user clicks the back or forward button). |
onresize | Fires when the browser window is resized. |
onstorage | Fires when a Web Storage area is updated (e.g., localStorage or sessionStorage). |
onunload | Fires once a page is unloaded (or the browser window is closed). |
HTML Attributes | Global Attributes | Event Attributes |
---|---|---|
To view the full list | To view the full list | To view the full list |
elements | |||||
---|---|---|---|---|---|
onoffline | 4 | 9 | 9 | 4 | 15 |
Improve Our Platform
Did you find what you were looking for?
Learn how to contribute.Last updated on by our contributors.
View this page on GitHub• Report an issue with this content