如何在history js插件中添加问号参数而不是正斜杠

时间:2013-08-07 12:53:43

标签: javascript jquery history.js


我试图改变这样的网址(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);
                }); 
            }

2 个答案:

答案 0 :(得分:2)

不确定它是否是错误或功能,但看起来像在查询中添加实际网址有助于:

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

答案 1 :(得分:0)

这是通过Histor.js或任何其他客户端脚本无法实现的......这应该在服务器端完成。