Home > SharePoint Advancements > Auto Refreshing SharePoint Page

Auto Refreshing SharePoint Page

I’ve been asked many times by my clients if its possible to refresh a SharePoint site on a time interval.  Yes it can, and its fairly simply just by using a Content Editor Webpart and some javascript.  Follow the steps below to auto refresh your SharePoint page/site.

1.  Edit your SharePoint site and add a Content Editor Webpart on your page.
2.  Edit the Content Editor Web Part and inside the Source Editor, copy the javascript code below.

<script>
var reloadTimer = null;
var sURL = unescape(window.location.pathname);
function setReloadTime(secs)
{if (arguments.length == 1)
   { if (reloadTimer) clearTimeout(reloadTimer);
       reloadTimer = setTimeout(“setReloadTime()”, Math.ceil(parseFloat(secs)*1000));
   }  
else   { reloadTimer = null;
     window.location=window.location;
     window.location.replace( sURL );
   }
}
setReloadTime(300);

</script>

3.  Set the setReloadTime(x) to x amount of seconds you would like to wait before refresh.

Enjoy!

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: