Sometimes, we want to add a link that reloads the current page with HTML and JavaScript.
In this article, we’ll look at how to add a link that reloads the current page with HTML and JavaScript.
How to add a link that reloads the current page with HTML and JavaScript?
To add a link that reloads the current page with HTML and JavaScript, we can use the window.location.reload
method.
For instance, we write
<a href="javascript:window.location.reload(true)">Reload</a>
to add a link that has the href attribute set to JavaScript code that calls window.location.reload
with true
to reload the page when we click on it.
Conclusion
To add a link that reloads the current page with HTML and JavaScript, we can use the window.location.reload
method.