点击浏览器后退按钮 返回指定页面

原创 13161846251 随笔 js 205阅读 2017-05-04 16:11:52 举报

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>;
<script type="text/javascript">
jQuery(document).ready(function ($) {
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 === '') {
window.location.href="<%=basePath%>userCentre/userBasicInfo/${userId}.htm";
}
}
});
window.history.pushState('forward', null, './#forward');
}
});
</script>

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复