【发布时间】:2016-03-24 12:15:31
【问题描述】:
当应用程序午餐或任何使用互联网调用的功能时我想检查互联网是否连接,所以我想显示如果 internet connection not connected in popup 如何在 worklight hybrid mobile application 中使用 jquery mobile .
请任何人告诉我这是怎么做的,任何人有样品请把它放在这个问题中。
我写下面的代码。
//main.js
var busyIndicator=null;
function wlCommonInit(){
busyIndicator = new WL.BusyIndicator('page', {text : 'Please Wait...'},{minDuration: '1s'},{color: "red"});
isOnline();
}
function isOnline() {
var online = navigator.onLine; // Detecting the internet connection
if(online) {
alert('You\'re online now...');
} else {
alert('You\'re Offline now...');
$("#errorPopup").popup("open");
}
}
<!--index.html -->
<div data-role="page" id="page">
<div data-role="content" style="padding: 15px">
<input type="text" id="txtTrtDtPreAprvlSubn"
placeholder="Treatment Date" required="required" autocomplete="off"
spellcheck="false" readonly="readonly">
</div>
</div>
<div data-role="popup" id="errorPopup" data-overlay-theme="b"
data-theme="b" data-corners="false" align="center">
<p>internet connection not connected</p>
</div>
【问题讨论】:
标签: jquery popup ibm-mobilefirst internet-connection