if (window.history && window.history.pushState) { $(window).on('popstate', function () { window.history.pushState('forward', null, '#'); window.history.forward(1); }); } window.history.pushState('forward', null, '#'); //在IE中必須得有這兩行 window.history.forward(1);當history實體被改變時,popstate事件將會發生; onhashchange()可監聽URL的hash部分。