Button that refreshes the page on click
Use onClick
with window.location.reload()
, i.e. :
<button onClick="window.location.reload();">Refresh Page</button>
Or history.go(0)
, i.e.:
<button onClick="history.go(0);">Refresh Page</button>
Or window.location.href=window.location.href
for 'full' reload, i.e.:
<button onClick="window.location.href=window.location.href">Refresh Page</button>
The Button element - developer.mozilla.org
This works for me:
function refreshPage(){
window.location.reload();
}
<button type="submit" onClick="refreshPage()">Refresh Button</button>
<a onClick="window.location.reload()">Refresh</a>
This really works perfect for me.