Since EE-4.0
The mobi:onlineStatus component renders an element that has its CSS class changed depending on what the online state of the browser. Also it provides attributes that can take Javascript code that is executed when browser goes online or offline.
To start using the online status component, simply place the mobi:onlineStatus tag inside a the body of the page and add the attributes for the on/off CSS classes and/or the Javascript code to be executed.
<h:body>
<style type="text/css">
.offlineBackground { background-color: red; }
.onlineBackground { background-color: green; }
</style>
<mobi:onlineStatus onlineStyleClass="offlineBackground" offlineStyleClass="onlineBackground"/>
</h:body>
<h:body>
<script type="text/javascript">
function offline(element) {
element.innerHTML = 'Your browser is offline!'
}
function online(element) {
element.innerHTML = '';
}
</script>
<mobi:onlineStatus onOnline="online();" onOffline="offline();"/>
</h:body>
TagLib Documentation
This section covers attributes involved in the typical use-cases for this component.
The onlineStyleClass attribute specifies the CSS class applied to the component's root element when browser is online.
The offlineStyleClass attribute specifies the CSS class applied to the component's root element when browser is offline.
The onOnline specifies the JavaScript to be evaluated when the browser goes online. The 'element' argument passed to the callback code is the root element of the component.
The onOffline specifies the JavaScript to be evaluated when the browser goes offline. The 'element' argument passed to the callback code is the root element of the component.
None.
None.
None.
None.
None.
This component appears in the following ICEfaces sample applications: