Answers for "how to pass query params on page 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 "Javascript"

Browse Popular Code Answers by Language