简体   繁体   中英

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:

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?

Yes, this is possible with the history API in the modern browsers using the pushState method. Here is an explanation .

试试pushState()

window.history.pushState({state:'new'},'New State','http://localhost:3000/boards/10?show_customize=false');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM