How to Create a Refresh Page Button using Javascript


In this article, we will show how to create a refresh/reload page button using Javascript.

This is simply a button which allows the page to refresh or reload, which is equivalent to pressing the refresh page button on a typical browser or pressing F5 of your keyboard to perform a refresh.

The code to perform a refresh of a page in Javascript is:

To place this function in a button, we would use the following code:

So, if we use the above line with this current page, we will get the following output:

Just so that you know that the page refreshes every time you click the button, shown below is a random number generator. Each time you click the refresh button, the page should show a different number below.

And this is quite simply how you can create a refresh button with Javascript.

HTML Comment Box is loading comments...