// If URL not finished on "/" - to add this "/" at the end without reload if (window.location.href.charAt(window.location.href.length - 1) !== "/") { window.history.replaceState({}, document.title, window.location.href + "/"); }