Site logo

[Support request] Page redirect after a certain amount of time

Home Forums Support [Support request] Page redirect after a certain amount of time

Home Forums Support Page redirect after a certain amount of time

  • This topic has 3 replies, 2 voices, and was last updated 5 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1793047
    Mike

    I’m setting up forms on a website and when the form is submitted, I’m redirecting them to a contact thank you page. How can I make that page then redirect back to the home page after a certain amount of time, say 5 seconds?

    I saw this code here, but not sure where and how to implement it. https://www.tutorialspoint.com/How-to-use-JavaScript-to-redirect-a-webpage-after-5-seconds

    Not sure if this is GeneratePress specific enough for support, if not no worries about deleting it!

    Thanks!

    Mike

    #1793139
    David
    Staff
    Customer Support

    Hi there,

    try using the code that topic provided:

    1. Create a new Hook Element:
    https://docs.generatepress.com/article/hooks-element-overview/

    2. Add the script to the Hook text area:

    <script>
    setTimeout(function(){
        window.location.href = 'https://www.tutorialspoint.com/javascript/';
    }, 5000);
    </script>

    Change the href to your home page.

    3. Set the Hook to: wp_head
    4. Set the Display Rules > Location to your thank you page.

    #1793295
    Mike

    Thank you David! Perfect!

    #1793525
    David
    Staff
    Customer Support

    Glad to be of help.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.