Hello Coders,
I need help… I want to create a welcome page with whatever loading animation or content I want then simply let it go to the home page lets say after 10 seconds…
FYI I saw the lightbox loading thing but its not good enough as it might look like a bottomless girl on big screens… So any code or method I can use to do so?
Check my website and see what i mean www.theiconcasa.com … i dont want the “enter” button… looks unprofessional… i want it to navigate to the home page after the loading animation directly…
Many Thanks…
2 Likes
You should be able to do this on the welcome page:
import wixLocation from 'wix-location';
$w.onReady(function () {
setTimeout(() => {
wixLocation.to("/main");
}, 10000);
});
After 10 seconds, it will redirect to the main page.
I hope this helps,
Yisrael
Wow! That helped… Many Thanks… made my day 
Where to write this code and what changes need to be made in my website?
Kalpit,
If your site has a “Welcome” page, that you want to display for a short time before redirecting to a “Home” (or “Main”) page, then you can use the code posted above to perform the redirection.
Hi Yisreal,
I have a client that wants this exact feature (animated video on landing page, that automatically redirects to the main page after 10 seconds).
I can’t get the code to work when testing it on a blank website template… this is the code I entered:
import wixLocation from ‘https://cutelittlevoice.wixsite.com/jillianniedoba’;
$w.onReady( function () {
setTimeout(() => {
wixLocation.to(“https://cutelittlevoice.wixsite.com/jillianniedoba/main”);
}, 10000);
});
What did I do wrong??
@keepdreamingcreative
you need to import wix-location correctly…
import wixLocation from ‘wix-location’;
@mikemoynihan99 Thank you! It worked!! 
Hi,
i have a homepage for desktop and a diferent homepage for mobil.
is there a way that my welcome page automatically loads to homepage according if it is desktop or mobil?
thanks!
@flexiroamar
Yes with the help of wix location and wix window we can detect the device and redirect to the page.
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
$w.onReady(() => {
if(wixWindow.formFactor === 'Mobile' {
wixLocation.to('/pageurl')
}
})
@salman-hammed thanks soo much!!
I put this:
import wixWindow from ‘wix-window’;
import wixLocation from ‘wix-location’;
$w.onReady(() => {
if (wixWindow.formFactor === ‘Mobile’){
wixLocation.to(‘https://www.flexiroamx.com.ar/home’)
}
if (wixWindow.formFactor === ‘Desktop’){
wixLocation.to(‘https://www.flexiroamx.com.ar/inicio’)
}
})
and is working well! if i wanted to go to the home page after 5 seconds, where should i put the code?
@belumesro
You can use setTime out
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(() => {
setTimeout(()=>{
if(wixWindow.formFactor === 'Mobile'){
wixLocation.to('https://www.flexiroamx.com.ar/home')
} else {
wixLocation.to('https://www.flexiroamx.com.ar/inicio')
}
} , 5000)
})
Hello, I’m trying to redirect mobile users to a specific page when they open homepage of my website.
I have inserted following code to my site:
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(funtion () {
if(wixWindow.formFactor === "Mobile"){
wixLocation.to('https://www.mywebsiteurl.com/mobile-page-name');
}
});
Redirect works, but it works only after first loading the original homepage. I would like users to be directed to my mobile page immediately after they click on my site url without loading the homepage first.
Thank you.
Hi all,
I’m trying to replicate this on my website (albeit new to the world of coding, so forgive me!)
Where am I going wrong with this code?
Many thanks,
T

place import wixLocation above $.onReady(function () {
Hope this helps 
You’re importing wixLocation from a directory ‘/home’, which makes no sense since wixLocation is an API. You import wixLocation from ‘wix-location’ because that’s what Wix has labeled that particular API in the backend.
It’s working fine for me too. One problem though…the formatting of the time.
I assumed (hah) that 10000 meant 10 seconds, but I only want 5 seconds, so I changed the 10000 to 05000 and it errors out (red dot before the code). What is the time format for each second of delay., in this particular case 5 seconds.
Cheers
1000 means: 1000 milliseconds, or 1 second.
Umm, just realised that maybe the leading zero in 05000 is causing the error. Try 5000 (milliseconds) which is 5 seconds.