比如<script src="style/jquery.min.js"></script>
监听事宜
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('後退按鈕點擊'); } } }); window.history.pushState('forward', null, './#forward'); } });
History 工具

History 工具包含用户(在浏览器窗口中)访问过的 URL。
History 工具是 window 工具的一部分,可通过 window.history 属性对其进行访问。
history.pushState(state, title, url)
将当前URL和history.state加入到history中,并用新的state和URL更换当前。不会造成页面刷新。
state:与要跳转到的URL对应的状态信息。
title:不知道干啥用,传空字符串就行了。
url:要跳转到的URL地址,不能跨域。