how to change url without changing browser history

You’re looking for replaceState(), it replaces the current position in the history instead of pushing a new one, like pushState() does

history.replaceState({}, 'Title', link.href);

from MDN

history.replaceState() operates exactly like history.pushState()
except that replaceState() modifies the current history entry instead
of creating a new one.

replaceState() is particularly useful when you want to update the
state object or URL of the current history entry in response to some
user action.

Remember, some functions are not available on older browsers. But there is a library
that could help you out.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)