浏览器后退时必定会有一些消息,这里使用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');}});