如何在历史js插件中添加问号参数而不是正斜杠
How to add question mark parameter instead of forward slash in history js plugin
我正试图这样更改网址(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);
});
}
不确定这是一个bug还是一个功能,但看起来向查询中添加一个实际的URL有帮助:
History.pushState({}, 'New title', window.location.pathname + "?" + ...);
这是无法通过Histor.js或任何其他客户端脚本实现的。。。这应该在服务器端完成。
相关文章:
- 函数参数中的数据与指定变量之间的任何性能差异
- 使用Express捕获参数
- 参数变量出现ngTable指令问题
- AngularJS:我可以跳过函数参数回调吗
- 如何使用skip参数使用angular ui引导进行服务器端分页
- 要求未定义JS回调参数
- 我的jQuery插件参数没有正确启动,遇到了问题
- 获取@ResponseBody的一部分作为主干和Spring MVC控制器之间的参数
- jquery设置为使用参数运行
- Javascript”;类“;带有参数的扩展
- 为什么grunt contrib connect的中间件选项的第三个参数是未定义的
- 函数未将值作为参数传递
- 如何将参数传递到angularJs中的工厂
- JS:检查URL中的参数,然后迭代一个参数为var的函数
- 正在传递JSONP标头's数据参数到另一个文件中的AJAX请求
- MVC 3页面导航和使用javascript传递参数
- 将状态添加到特定搜索参数的历史记录中
- 如何在历史js插件中添加问号参数而不是正斜杠
- 当我推送一个新的URL到主干.历史记录,查询参数保留
- aurelia路由器-传递一次参数(参数不会记录在浏览器历史记录中)