浏览器后退时必定会有一些消息,这里使用jquery判断浏览器后退并弹出消息
view source
print?01 jQuery(document).ready(function ($) {
02 if (window.history && window.history.pushState) {
03 $(window).on('popstate', function () {
04 var hashLocation = location.hash;
05 var hashSplit = hashLocation.split("#!/");
06 var hashName = hashSplit[1];
07 if (hashName !== '') {
08 var hash = window.location.hash;
09 if (hash === '') {
10 alert("Back button isn't supported. You are leaving this application on next clicking the back button");
11 }
12 }
13 });
14 window.history.pushState('forward', null, './#forward');
15 }
16 });
中国足彩网信息请查看IT技术专栏
2025国考·省考课程试听报名