Page Redirect using CEWP JavaScript in SharePoint

There are some situations, where we need to place re-directs in SharePoint pages. OK.. How to do that?

Simple! We can redirect using content editor web part in SharePoint. Just add a content editor web part, and place the below JavaScript code:

alert(“This application has been moved to replaced with an another version, please update all existing bookmarks. You will be redirected momentarily.”);
// ]]>

<meta http-equiv=”refresh” content=”0;url=<a rel=”nofollow” href=https://MyNewURL/default.aspx class=”vglnk”><span>https</span><span>://</span><span>MyNewURL</span><span>/</span><span>default</span><span>.</span><span>aspx</span></a>”>

This will redirect to another page. You can use SharePoint’s native method also:


function redirect() {
//sharepoint 2010 redirect page 5 seconds
setTimeout(“location.href=’‘”, 5000);



SharePoint redirect before page load

The main disadvantage over the above methods is delay! We’ve to wait until the web part loads. What we can do to mitigate the delay is: Take-off all content from default.aspx and place the below code in it (via SPD):

<%@ Page language=”C#” Inherits=”Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c” %>


window.location.href = ““;





Author: "Sharepoint Thoughts"

I’m a Microsoft Certified IT Professional with 5+ Years Experience on SharePoint Technologies. Worked extensively on “SharePoint 2007”, “SharePoint 2010”, “SharePoint 2013” & “SharePoint 2016” on Implementation, Configuration & Troubleshooting several Projects.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s