h5使用HBuilderX打包app使用系统返回退出app - 已解决

document.addEventListener('plusready',function(){
    var webview = plus.webview.currentWebview();
    plus.key.addEventListener('backbutton', function() {
       webview.canBack(function(e) {
          if (e.canBack) {
             webview.back();
          } else {
             webview.close();//hide,quit
          }
       })
    });
});

在h5公共js页面插入以上代码就可以了,亲测有效

你可能感兴趣的:(javascript,android,studio)