2


我正在尝试像这样更改网址(http://www.rangde.org/gift-cards?theme=Anniversary
但我得到的输出是(http://www.rangde.org/gift-cards/ ?theme=Anniversary
我不希望问号参数前面的正斜杠请帮我解决这个问题
我的脚本在这里:

 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 回答