ハッシュURLを取得して何かきれいなものを出力するにはどうすればよいですか?URLからのストリップハッシュ
domain.com/page/1
$(document).ready(function(){
var newHash = '';
$('#wrapper a').live('click', function(e){
if (this.hostname && this.hostname == location.hostname) {
e.preventDefault();
var link = $(this).attr('href');
window.location.hash = link;
}
});
$(window).bind('hashchange', function() {
newHash = window.location.hash.substr(1);
$('#content').fadeOut(100).load(newHash + ' #contentInner', function(){
$('#content').fadeIn(100);
});
});
});
ものは2つの完全に異なるURLです。彼らはさまざまなリソースを指しています。最初はdomain.comのデフォルトのインデックスを指し、domain.comの/ page/1の2番目のインデックスを指します。ハッシュの前のすべてがリソース名とオプションのパラメータを記述し、後のすべては通常クライアントが処理するリソースを持つアンカーです。 – jiggy
正しく理解していれば、これを達成するには[HTML5履歴API](http://diveintohtml5.org/history.html)が必要です。 –