Spiga

How to Reload the Page With JavaScript

June 08, 08 by Gabi Solomon

There are a few ways you can reload a page with javascript. I will post them all below, and for demonstration i will put them as button onclick action.

Using location.reload

HTML:
  1. <input onclick="window.location.reload()" type="button" value="Reload Page" />

Using history method

HTML:
  1. <input onclick="history.go(0)" type="button" value="Reload Page" />

Using location.href

HTML:
  1. <input onclick="window.location.href=window.location.href" type="button" value="Reload Page" />