Created
September 28, 2023 14:06
-
-
Save rubinchyk/b25dd8e5428f2801a3f20acce88d224d to your computer and use it in GitHub Desktop.
[To change URL without page reload] To change URL without page reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 + "/"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment