Refresh a page using JavaScript or HTML [duplicate]

How can I refresh a page using JavaScript or HTML?


Solution 1:

window.location.reload(); in JavaScript

<meta http-equiv="refresh" content="1"> in HTML (where 1 = 1 second).

Solution 2:

Here are 535 ways to reload a page using javascript, very cool:

Here are the first 20:

location = location
location = location.href
location = window.location
location = self.location
location = window.location.href
location = self.location.href
location = location['href']
location = window['location']
location = window['location'].href
location = window['location']['href']
location = window.location['href']
location = self['location']
location = self['location'].href
location = self['location']['href']
location = self.location['href']
location.assign(location)
location.replace(location)
window.location.assign(location)
window.location.replace(location)
self.location.assign(location)

and the last 10:

self['location']['replace'](self.location['href'])
location.reload()
location['reload']()
window.location.reload()
window['location'].reload()
window.location['reload']()
window['location']['reload']()
self.location.reload()
self['location'].reload()
self.location['reload']()
self['location']['reload']()

Original Article

Solution 3:

simply use..

location.reload(true/false);

If false, the page will be reloaded from cache, else from the server.

Solution 4:

window.location.reload()

should work however there are many different options like:

window.location.href=window.location.href

Solution 5:

You can also use

<input type="button" value = "Refresh" onclick="history.go(0)" />

It works fine for me.