jquery判断浏览器后退时候弹出消息的方法

时间:2014-08-11    点击:69   

浏览器后退时必定会有一些消息,这里使用jquery判断浏览器后退并弹出消息

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 === '') {
alert("Back button isn't supported. You are leaving this application on next clicking the back button");
}
}
});
window.history.pushState('forward', null, './#forward');
}
});

深入理解Javascript中this的作用域
javascript实现在某个元素上阻止鼠标右键事件的方法和实例
JavaScript弹出窗口方法汇总
Javascript中3种实现继承的方法和代码实例
jQuery判断checkbox是否选中的3种方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved