Sometimes, we want to replace a window’s URL hash with another response with JavaScript.
In this article, we’ll look at how to replace a window’s URL hash with another response with JavaScript.
How to replace a window’s URL hash with another response with JavaScript?
To replace a window’s URL hash with another response with JavaScript, we can set the window.location.hash
property.
For instance, we write
window.location.hash = "#food";
to replace the hash of the current URL with #food
.
Conclusion
To replace a window’s URL hash with another response with JavaScript, we can set the window.location.hash
property.