// 手机端网页: 处理手机返回键 window.onpopstate = function (event) { // 监听到已经按下返回键,获取URL var url = "" + document.location + ""; var returnDialog = dialog({ width : 260, content : '<p class="tc">确定放弃上传商品?</p>', okValue : '确定', cancelValue : '返回', ok : function(){ window.history.go(-1); return true; }, cancel : function(){ history.pushState("x-back", null, location.href); //停留在当前页面 return true; } }); returnDialog.showModal(); }; // 需要push一笔数据到history // history.pushState({'page':1}, "title", "XXXXXXXXXXX"); history.pushState("x-back", null, location.href);详细可查看https://www.cnblogs.com/zhuchenglin/p/7607768.html
手机端网页处理手机返回键
最新推荐文章于 2021-12-09 15:44:16 发布