EMS2.0-Documents/1.源代码/APP源代码/IEMS-APP/public/index.html

40 lines
1.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>