JS 监听手机返回键,回到指定界面
<script>
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 === '') {
// 这里跳转页面
console.log("你点击了返回键");
}
}
});
window.history.pushState('forward', null, './#forward');
}
</script>

浙公网安备 33010602011771号