Categories
JavaScript Answers

How to replace a window’s URL hash with another response with JavaScript?

Spread the love

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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.