javascript监听手机返回键

javascript监听手机返回键

<pre>
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 === '') {
$('.tcclose').css('display', 'none');
return false;
}
}
});
window.history.pushState('forward', null);
}
</pre>

posted @ 2019-11-14 12:26  newmiracle宇宙  阅读(290)  评论(0编辑  收藏  举报