Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Tuesday 28 February 2012

Reloading The Page Using Javascript

If you wish to put a nice little Reload this page link in your page, the javascript provides a reload() method that you can use for reloading the page.

The reload() method in window.location can be used to reload the page and works well in most of the browsers. An example snippet is shown below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">

 <title>Reload example</title>
 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
 <meta name="generator" content="Geany 0.20" />

 <iframe height="300" width="300" src="http://wwwindow.location.reload(true)"></iframe>
 <a href="javascript:window.location.reload(true);">Reload this page</a>.


I hope this comes useful sometimes.