8***@qq.com
8***@qq.com
  • 发布:2019-02-22 14:59
  • 更新:2019-02-22 14:59
  • 阅读:781

android返回到index.html时app会直接关闭ios不存在这个问题

分类:MUI

index.html在根目录

执行页面代码路径html/my.html

返回到首页的代码:clearlogin('../index.html');

公用js:
function clearlogin(_target) {
//_target为首页的相对地址
//清除缓存数据
localStorage.removeItem("mylogin");
localStorage.removeItem("mytype");
localStorage.clear();
//获取当前webview
var curwv = plus.webview.currentWebview();
//获取所有webview
var allwv = plus.webview.all();
//关闭除当前以外的其他webview
for(var i = 0; i < allwv.length; i++) {
if(allwv[i].getURL() != curwv.getURL()) {
plus.webview.close(allwv[i]);
}
}
//打开首页
plus.webview.open(_target);
//关闭当前页
plus.webview.close(curwv);
}

2019-02-22 14:59 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复