If I have a link that is being changed with the function history.pushState({}, \"\", link); where my link is for example page.php?value=1&
history.pushState({}, \"\", link);
link
page.php?value=1&
You can use this useful function to change a query string parameter value:
function updateParam(url, param, value) { var re = new RegExp(param+"(.+?)(&|$)","g"); return url.replace(re, param+'='+value) }