how to insert url without refreshing page code example
Example 1: change href without reloading page js
const nextURL = 'https://my-website.com/page_b';
const nextTitle = 'My new page title';
const nextState = { additionalInformation: 'Updated the URL with JS' };
window.history.pushState(nextState, nextTitle, nextURL);
window.history.replaceState(nextState, nextTitle, nextURL)
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);
}