微信浏览器监听手机物理返回键实现无限返回

history.pushState(history.length + 1, "message", window.location.href.split('#')[0] + "#" + new Date().getTime());
if (navigator.userAgent.indexOf('Android') != -1) {
   if (typeof(tbsJs) != "undefined") {
     tbsJs.onReady('{useCachedApi : "true"}', function(e) {});
     window.onhashchange = function() {
       location.href = '你的跳转地址';
     };
   } else {
     window.onhashchange = function(event) {
         history.go(1);
     };
   }
 } else {
   window.onhashchange = function() {
       location.href = '你的跳转地址';
   };
 }

版权声明:本文为weixin_39152200原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。