how to redirect users on mobile view?

hi there, i want to redirect users that click on my homepage on google results - to a specific page on my site.
this is a light-weight page, designed for mobile users. (for better loading speed)
i know how to find out if a user is viewing my site using a mobile device:

import wixWindow from ‘wix-window’;
$w.onReady(function () {
if(wixWindow.formFactor === “Mobile”){
function to redirect
}

just need help with the issue of re-directing…
many thanks,
:slight_smile:

1 Like

Easy with ’ wixLocation ':

import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(function () {
    if(wixWindow.formFactor === "Mobile"){
        wixLoaction.to('/someOtherPage');
    }
 }

Hope this helps,

Liran.

Liran always comin through

Hi, i’m using this code but need to redirect after 5 seconds? is there a way to get that?

There are two typos in your code:

  1. it’s ‘Location’, not ‘Loaction’ (easy to see)
  2. there is a parenthesis missing. I am new to coding so it took me two hours to figure it out.

@guillejusjus Mind telling us what parenthesis are missing? This code is not working for me.