You have two options here you can either use pushState
(more info) or you can use Hash key navigation (more info) if you wish to make it compatible with browsers that do not yet have pushState
available.
pushState example:
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
Hash Key example:
if ("onhashchange" in window) {
alert("The browser supports the hashchange event!");
}
function locationHashChanged() {
if (location.hash === "#somecoolfeature") {
somecoolfeature();
}
}
window.onhashchange = locationHashChanged;
For more info here is another link: Change the URL in the browser without loading the new page using JavaScript