none
Automatic redirect after 5 seconds RRS feed

  • Question

  • Hi,

    I want an automatic Redirect from my dispform.aspx to dispform2.aspx with the current ID used.

    e.g. http://myintanet/lists/user/DispForm.aspx?ID=104 to http://myintanet/lists/user/DispForm2.aspx?ID=104.

    My Problem is the ID - every Redirect I used worked, but without the current ID - so it doesn't show the right user.

    Please help. 


    Monday, October 21, 2019 5:52 AM

All replies

  • Hi Vertical74,

    You can add a Content Editor web part in the display form page and use the Javascript to redirect to another display form page, here is a demo for your reference:

    <script src="https://code.jquery.com/jquery-3.2.1.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    function getQS(key) {
    
         var regex=new RegExp('[\\?&amp;]'+key+'=([^&amp;#]*)');
    
         var qs=regex.exec(window.location.href);
    
         return qs[1];
    
       }
    
    var itemID = getQS('ID');
    
    var targetUrl = "http://sp13/Lists/list4/DispForm2.aspx?ID=" + itemID;
    
    function redirect() {  
    
       setTimeout("location.href = targetUrl", 5000);
    
    }
    
    _spBodyOnLoadFunctionNames.push("redirect");
    
    </script>

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, October 22, 2019 3:33 AM
  • Hi Vertical74,

    I’m checking how the things are going on about this thread. Whether the post helps you?

    You can mark the post as answer if it helps.

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, October 28, 2019 8:51 AM