Question:
Hi everyone,
I’m working on a website using Wix Studio, and I need a bit of help with a redirect. I want the homepage to stay loaded for 3 seconds before automatically redirecting to the “Contact” page. I’ve already tried a code that works in theory, but it doesn’t seem to function as expected.
Could anyone guide me on the correct code or any adjustments I need to make to achieve this effect?
Thanks in advance!
import wixLocation from 'wix-location';
$w.onReady(function () {
setTimeout(function() {
wixLocation.to("/contact"); // Redirects to the Contact page after 3 seconds
}, 3000); // 3000 milliseconds = 3 seconds
});
On top of my head, I can think of one potential reason. The new wix pages have slug like /blank, /blank-1, and so on. May sure your page slug is correct. You can find it in SEO settings.
Also use this debug code to see if the code is working correctly, use this code and preview inside the editor(not a test site)