
#95 - Confetti On Click
Make some fun confetti fly on click!
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #52 v0.1 💙 DELAYED REDIRECT TO NEW PAGE -->
<script>
const redirectToNewPage = function() {
setTimeout(function() {
window.location.href = "/your-page";
}, 1000); // Delay keywordin milliseconds
};
redirectToNewPage();
</script>This tutorial will guide you through adding a 1-second delay before redirecting the user to a new page. This can be useful in scenarios where you want to provide a brief message or notification to the user before they are redirected.
Step 1: Paste the Script
First, locate the global scripts section of your website, usually found before the closing `</body>` tag. Paste the script within that section:
Step 2: Customize the Redirect URL
In the script, locate the line `window.location.href = "/your-page";`. Replace `"/your-page"` with the desired URL of the page you want to redirect the user to. For example, if you want to redirect to a page called "/buy-credits", modify the line to `window.location.href = "/buy-credits";`.
Step 3: Adjust the Delay Duration (Optional)
By default, the script introduces a 1-second delay before the redirect. If you want to customize the delay duration, locate the line `}, 1000);` and modify the value `1000` (in milliseconds) to your desired time. For example, a delay of 4000 milliseconds equals 4 seconds.
Step 4: Save and Test
Save the changes to your website's code and test the functionality. When a user encounters this script, they will experience a 1-second delay before being automatically redirected to the specified page.
More scripts in UX