40 lines
1.4 KiB
HTML
40 lines
1.4 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html>
|
|||
|
|
|||
|
<head>
|
|||
|
<meta charset="utf-8">
|
|||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,viewport-fit=cover">
|
|||
|
<meta http-equiv="pragma" content="no-cache">
|
|||
|
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
|
|||
|
<meta http-equiv="expires" content="0">
|
|||
|
<!-- <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=initMap&key=ApPHTYzzTYmqhajRcGVNWS44SEBCBKp2F6ih95VOzvBvN2tIhogM-Di66ZpFb2C9' async defer></script> -->
|
|||
|
<title>智慧能源柜</title>
|
|||
|
</head>
|
|||
|
|
|||
|
<body onload="backbutton()">
|
|||
|
<div id="app"></div>
|
|||
|
<script>
|
|||
|
// 连续点击返回按键,退出app
|
|||
|
var backClick = 0;// 退出点击次数,默认为0
|
|||
|
function backbutton() {
|
|||
|
var time = new Date(); // 0.5s内再次点击就退出
|
|||
|
// 监听返回按钮
|
|||
|
document.addEventListener('backbutton', function (evt) {
|
|||
|
if (backClick) { // 不为0时
|
|||
|
navigator.app.exitApp(); // app退出
|
|||
|
} else {
|
|||
|
// alert('再按一次退出App'); // 提示信息
|
|||
|
if (new Date() - time < 500) {// 小于0.5s(500),退出程序
|
|||
|
backClick++;
|
|||
|
} else { // 大于0.5s,重置时间戳,
|
|||
|
time = new Date();
|
|||
|
history.back(); // 不满足退出操作,,返回上一页
|
|||
|
}
|
|||
|
}
|
|||
|
}, false);
|
|||
|
}
|
|||
|
</script>
|
|||
|
</body>
|
|||
|
|
|||
|
</html>
|