Sometimes you  want to add a refresh page or reload page link to your web page. This might be for purposes when you are live blogging, posting newsy contents in real time or engaging in a quick discussion on quick blogging themes.

Advertisements

Javascript Refresh Link

Reload

The easiest way would seem to link to the permalink of the page, and clicking it will simply revisit the page again. But then the next methods are independent of links added to the code.

The simplest way is to use a javascript link and it looks like this. This will create a link and clicking it will simply reload the page of the current url as visible in the browser url field.

<a href="javascript:location.reload();" >RELOAD PAGE</a>

You can test demo link here – RELOAD PAGE

Javascript Reload Button

If you prefer to display this code as button, use the input tags and a button will appear instead of a link.

<input type="button" value="Reload page" onclick="location.reload();"> 

You can test demo button here –

Its easy to add classes to style the links and buttons as per your site design. Just add CSS style to the class ‘yourstyle’ and get an amazing number of options.

<a class="yourstyle" href="javascript:location.reload();" >RELOAD PAGE</a>

Reload Page Button

If you do not want to add the scripts in the html body, then another way is to put the script in the HEAD of the html code like this

<script>
function reloadPage()
{
location.reload();
}
</script>

The use of input tags create the buttons as needed. Click to refresh the page.

<input type="button" value="Reload page" onclick="reloadPage()">

Auto Refresh Web Pages

Use this with care as such pages will continue to autorefresh is left alone in a browser window and can affect page traffic statistics.

You can force reloading of pages after selected time intervals using META refresh tags. In the example below, the page will refresh every 30 seconds.

<META HTTP-EQUIV="refresh" CONTENT="30">

If the url is fixed, the you can add the urls link also to the page

<META HTTP-EQUIV="refresh" CONTENT="30" URL="http://domain.com/">

12 Comments   BloggingTutorials