without reloading page can i change url and valuenodejs code example

Example 1: javascript change url without reload

window.history.pushState('', 'New Page Title', '/new-url.php');

Example 2: change url without reloading

function processAjaxData(response, urlPath){
     document.getElementById("content").innerHTML = response.html;
     document.title = response.pageTitle;
     window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
 }

Example 3: without refresh update url in js

history.pushState(state, title, url)

Tags:

Misc Example