Redirect SharePoint Natively with a Content Editor Webpart

It can be a pain as you reorganize your site and try to get users to update their links.
 
Here’s a handy way to do a redirect without editing anything server side.  Not that that’s what you should do in SharePoint any way.  
 
 
Add this snip of code below to to the content editor web part in HTML view on the page you want to redirect from.  You will likely want to change the header bar to none to hide the web part as well.
 
Code Snip: Edit the URL and time as desired.
 
——————
 
  function redirectAfterPause() {
    setTimeout(“location.href=’http://www.bing.com'”, 15000);
  }
  _spBodyOnLoadFunctionNames.push(“redirectAfterPause”);
 
 
—————–
 
Note 5000=1 second.  Replace bing with your target URL.  Thanks Darin, not sure where you got this, but if you found this somewhere, thanks to that developer as well, and hope you don’t mind me sharing it!
 
Note that _spBodyOnLoadFunctionNames is a native SharePoint Function.

2 Comments on “Redirect SharePoint Natively with a Content Editor Webpart

  1. Joel, not to nitpick but 5000 would be 5 seconds since the time is in milliseconds. The blog entry lists 5000 = 1 second.

    Ryan

    • Thanks Ryan! Haven’t thought about this one in a while. Thanks for clarifying.

      Joel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Collabshow.com

Subscribe now to keep reading and get access to the full archive.

Continue reading