Auto redirecting

Good day everyone,

I’m trying to figure out how I can get a page to redirect to another page automatically.
I created an email form which when the sent button is clicked on it goes to a page saying “Sent”. I want to get the "Sent’ page to automatically redirect back to the oringal page somehow after say 5 seconds. Is this possible?

:blush:

@lancerobrts, From what I know of Sparkle I don’t belief you can auto-redirect a page to another page based on time. The possible other way you can do it is by using the “Advance Form Submission” where you can nominate the URL after a successful send.

As a designer I don’t see it a problem being sent to a thank you page. That way you can flesh out the page to accomodate for a “warm lead”. Also the “warm lead” can continue to where they’d like to go with your main navigation still being present.

Thanks @FlaminFig , I’ll take a look at the Advance Forms and see what I can do.
I put the email form at the end of my website, so by the time they’ve gone through all the info they can then send a message and go on their way.
So maybe you’re right, I should just leave it at that and not force them to return to the page. Will have a think about it.
Cheers
:+1:

1 Like

While it isn’t possible directly in Sparkle currently, this is a case where a tiny amount of code can help solve the issue.

You add an embed in the thank you page and turn off “activate after consent”, then place this code in it:

<script>
setTimeout(function () {
      window.location.href = "/";
}, 5000);
</script>

This will redirect to the home page (the /), you can change that to the filename of the page you want the redirect to go to.

The 5000 is the number of seconds (times 1000), so replace the 5 with how many seconds you want to wait before the redirect.

9 Likes

I have been using this script on two websites for months now and it works perfectly. This is a good example of how a little “code embedding” can extend the functionality of Sparkle. :+1::slightly_smiling_face:

1 Like

Thanks @duncan , I’ll give it a shot and see how it works.
:+1:

I’m very impressed with this forum, very quick and helpful replies.
Thanks everyone
:blush:

1 Like

The community here is gentle, yes. :slight_smile:

2 Likes

Thank you @duncan for providing this script. I just stumbled over this thread and couldn’t resist to play around a bit (www.sfbdesign.de/playground/redirect). I find it a very useful little tool that opens new creative possibilities.

1 Like