0
到URL我注意到,history.js在支持HTML5的瀏覽器會自動更改重定向hashbang與history.js
http://www.site.com/some/path#/other/path
到
http://www.site.com/other/path
。 這很好,但實際上並未將瀏覽器重定向到/ other /路徑,它只是更改地址欄中的網址。 我需要它也重定向。我確實試圖抓住這個:
<script>
$(function() {
$(window).on('statechange', function() {
var State = History.getState();
console.log('state', State.url);
});
});
</script>
但statechange事件從來沒有發生......所以我怎麼做重定向?