document.location.reload(). You can add the
true keyword to force the reloaded page to come from the server (instead of cache). Alternatively, you can use the
false keyword to reload the page from the cache.
This code can be called automatically upon an event or simply when the user clicks on a link.
View the result (opens in new window)
You can achieve the same effect using the HTML meta tag.
Other Refresh Tricks
By including your refresh code in a function, you can have complete control over when the page is refreshed.
Instead of having the "page refresh" function called automatically when the page loads, you can call it only when the user performs some action - such as clicking on a link.
You can use conditional statements to determine whether or not to refresh the page. Here's a basic example of using a "confirm" box to ask the user if it's OK to refresh the page.
Enjoy this page?
- Link to this page (copy/paste into your own website or blog):
- Link to Quackit using one of these banner ads.
Thanks for supporting Quackit!