2


このように URL を変更しようとしています ( http://www.rangde.org/gift-cards?theme=Anniversary )
しかし、得られる出力は ( http://www.rangde.org/gift-cards/ ?theme=Anniversary )
クエスチョン マーク パラメータの前にスラッシュを入れたくない pls はこれを修正するのを手伝ってくれる
私のスクリプトはここにあります:

 History.pushState({state:1,rand:Math.random()}, 'Designs', '?theme=Diwali');   
    function(){     
                var History = window.History, // Note: We are using a capital H instead of a lower h
                State = History.getState(),
                $log = $('#log');

                History.log('initial:', State.data, State.title, State.url);

                History.Adapter.bind(window,'statechange',function(){ // Note: We are using statechange instead of popstate

                var State = History.getState(); // Note: We are using History.getState() instead of event.state
                History.log('statechange:', State.data, State.title, State.url);
                }); 
            }
4

2 に答える 2

2

バグなのか機能なのかはわかりませんが、クエリに実際の URL を追加すると役立つようです。

History.pushState({}, 'New title', window.location.pathname + "?" + ...);   
于 2013-11-15T05:14:08.677 に答える
0

これは、Histor.js やその他のクライアント側のスクリプトでは実現できません。サーバー側で行う必要があります。

于 2013-08-08T08:57:28.450 に答える