解决微信界面返回问题

来源:互联网 发布:手机淘宝上如何开网店 编辑:程序博客网 时间:2024/05/19 10:15
把代码写在1页面的点击进入下一级的事件中,点击手机自带的返回就会有效果,(事列:所有页面在一个网页中显示,控制显隐)
if (window.history && window.history.pushState){$(window).on('popstate', function() {var hashLocation = location.hash;var hashSplit = hashLocation.split("#!/");var hashName = hashSplit[1]; if (hashName !== '') {var hash = window.location.hash;if (hash === '') {//alert('后退');
$(".wxxxl").hide();$("#soxxxxng").show();soslist(state);局部刷新,重新请求数据函数} }});window.history.pushState('forward', null, "http://xxxxx?xxx=xxx&xx等需要刷新的界面地址"); }

0 0