Answers for "add query param to url without refresh"

5

javascript change query parameter without reloading

window.history.pushState('', 'New Page Title', '/new-url.php');
Posted by: Guest on July-22-2019
0

js set query params without reload

if (history.pushState) {
    var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?myNewUrlQuery=1';
    window.history.pushState({path:newurl},'',newurl);
}
Posted by: Guest on August-27-2021

Code answers related to "add query param to url without refresh"

Code answers related to "Javascript"

Browse Popular Code Answers by Language