//雙擊退出應用 //調用h5+ function plusReady() { // 監聽“返回”按鈕事件 plus.key.addEventListener("backbutton", function() { window.history.back(-1); }); // 在這里調用plus api } if (window.plus) { plusReady(); } else { document.addEventListener('plusready', plusReady, false); } var first = null; mui.back = function() { // 首次按鍵,提示‘再按一次退出應用’ if (!first) { first = new Date().getTime(); mui.toast('再按一次退出應用'); setTimeout(function() { first = null; }, 1000); } else { if (new Date().getTime() - first < 1000) { plus.runtime.quit(); } } };