locked
Redirect to Other SPSite RRS feed

  • Question

  • Hi

    I have shifted a SP site to another location, I want to redirect users from previous site to new site. What i am doing is using the JavaScript with Content Editor web part.
    <SCRIPT type='"text/javascript"'>// <![CDATA[
    alert("This site has been moved to another location, please update all existing bookmarks.  You will be redirected momentarily.");
    ]]></SCRIPT>
    <meta http-equiv="refresh" content="20;url=http://MYSERVERNAME.com/Pages/default.aspx">

    This shows user a popup message,
    I dont wanna use POPUP message, I want this message to be displaid inside the content Editor webpart with countdown timer to 20 secs.

    How can i do that
    Regards
    SharePoint 2007 (Administration/Development) | Web developer and .NET DTS Programmer | .NET Framework 2.0/3.5 | SQL Server 2008/2005/2k
    Wednesday, August 10, 2011 5:40 AM

Answers

  • try the following js code with Content Editor web part

     

    <script language="JavaScript" type="text/javascript">

            var count = 6

            var redirect = "http://www.google.com"

     

            function countDown() {

                if (count <= 0) {

                    window.location = redirect;

                } else {

                    count--;

                    document.getElementById("timer").innerHTML = "This page will redirect in " + count + " seconds."

                    setTimeout("countDown()", 1000)

                }

            }  

        </script>

        Our webpage has moved. Please update your bookmarks for the new site. <span id="timer">

            <script>

                countDown();  

            </script>

        </span>

    Regards,

     

    Moderator Note: NEVER propose your own posts as answers. The function is for proposing the good answers of other people.
    • Proposed as answer by Fadi Abdulwahab Sunday, August 14, 2011 6:57 AM
    • Unproposed as answer by Mike Walsh FIN Sunday, August 14, 2011 7:09 AM
    • Edited by Mike Walsh FIN Sunday, August 14, 2011 7:10 AM Moderator Note added about not proposing own posts as answers.
    • Marked as answer by aliusman Tuesday, August 16, 2011 12:55 AM
    Saturday, August 13, 2011 8:19 AM

All replies

  • Why dont you just open your page in sharepoint desinger and in that page under head section write the below statement. It will not give you any pop up. Or you make new aspx page in SPD.

    <meta content="20;url=http://MYSERVERNAME.com/Pages/default.aspx"
    http-equiv='refresh'/>

    and under body tag add your line "This site has been moved to another location, please update all existing bookmarks.  You will be redirected momentarily."

     

    Hope this helps you.

     


    Thanks -NK
    Wednesday, August 10, 2011 7:36 AM
  • Hi,

    You can also add 2content edito webparts.

    In the first webpart you can write the message about new site and in the second one you can write script for redirection without any pop up.

    I hope this will help you out.


    Thanks, Rahul Rashu
    Wednesday, August 10, 2011 12:36 PM
  • you can use a content editor web part with javascript timer function to show the user a message before redirect him to the new place by implementing the following code:

     

    <script type="text/JavaScript">
    <!--
    redirectTime = "1500";
    redirectURL = "http://www.google.com";
    function timedRedirect() {
    setTimeout("location.href = redirectURL;", redirectTime);
    }
    timedRedirect()
    // -->
    </script>
    <div>
    we move the page to new site ....
    </div>ck me for a timed redirect. </div>

    Wednesday, August 10, 2011 8:26 PM
  • Guys Thank you but my question is to SHOW COUNT DOWN TIMER like 10, 9 , 8 , 7 , 6 , 5 ..... 0

     


    SharePoint 2007 (Administration/Development) | Web developer and .NET DTS Programmer | .NET Framework 2.0/3.5 | SQL Server 2008/2005/2k
    Thursday, August 11, 2011 7:03 AM
  • try the following js code with Content Editor web part

     

    <script language="JavaScript" type="text/javascript">

            var count = 6

            var redirect = "http://www.google.com"

     

            function countDown() {

                if (count <= 0) {

                    window.location = redirect;

                } else {

                    count--;

                    document.getElementById("timer").innerHTML = "This page will redirect in " + count + " seconds."

                    setTimeout("countDown()", 1000)

                }

            }  

        </script>

        Our webpage has moved. Please update your bookmarks for the new site. <span id="timer">

            <script>

                countDown();  

            </script>

        </span>

    Regards,

     

    Moderator Note: NEVER propose your own posts as answers. The function is for proposing the good answers of other people.
    • Proposed as answer by Fadi Abdulwahab Sunday, August 14, 2011 6:57 AM
    • Unproposed as answer by Mike Walsh FIN Sunday, August 14, 2011 7:09 AM
    • Edited by Mike Walsh FIN Sunday, August 14, 2011 7:10 AM Moderator Note added about not proposing own posts as answers.
    • Marked as answer by aliusman Tuesday, August 16, 2011 12:55 AM
    Saturday, August 13, 2011 8:19 AM
  • cheers mate, Thank you
    SharePoint 2007 (Administration/Development) | Web developer and .NET DTS Programmer | .NET Framework 2.0/3.5 | SQL Server 2008/2005/2k
    Tuesday, August 16, 2011 12:55 AM