Today I’m going to show you how to setup a javascript refresh function that can be called whenever you would like to refresh the page. This code can also work as a redirect script.

Lets start with the function…

<script type=”text/javascript”>
function pageRefresh(timeoutPeriod) {

Now lets look at the call for this function. This is how you would call this function from page load. You could also use this function within an onClick, onSubmit, onPress, etc…here we are using it as a “onload” on the body tag.

<body onload=”JavaScript:pageRefresh(5000);”>

As usual, I’ve bolded the spot that you can edit to your liking. This refresh function is going to be executed at 5 seconds after the page has loaded. You could change this to whatever you would like.

Leave a Reply

Enter Code (required)

  Copyright © 2009 All rights reserved.