2013-08-07 11 views
2


我試圖改變這樣的網址(http://www.rangde.org/gift-cards?theme=Anniversary
但我得到的輸出是(http://www.rangde.org/gift-cards/?theme=Anniversary
我不想斜槓在問號參數前請幫我解決這個問題
我的腳本是在這裏:如何在歷史JS插件添加的,而不是正斜槓問號參數

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); 
       }); 
      } 

回答

0

沒有通過Histor.js或任何其他客戶端腳本實現的......這應該在服務器端完成。

2

不知道是否錯誤或功能,但看起來像加入一個實際的URL查詢幫助:

History.pushState({}, 'New title', window.location.pathname + "?" + ...); 
+0

這爲我工作,但我需要修剪掉路徑尾隨「/」 。 – Feckmore

相關問題