[英]Can I change a value in the url from true to false
I don't want to reload I just want to change the value in the url as follows: 我不想重新加载我只想更改url中的值,如下所示:
http://localhost:3000/boards/10?show_customize=true
to 至
http://localhost:3000/boards/10?show_customize=false
Can I do this with jquery or javascript? 我可以用jquery或javascript做到这一点吗?
Yes, this is possible with the history API in the modern browsers using the pushState
method. 是的,使用
pushState
方法在现代浏览器中使用历史记录API是可行的。 Here is an explanation . 这是一个解释 。
window.history.pushState({state:'new'},'New State','http://localhost:3000/boards/10?show_customize=false');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.