Mobile Site: Code Not Working Correctly

Hi Wix Community,

I was wondering why the wix onReady code was not working on my Mobile Published Site. I am currently coding my site to do some neat features and it isn’t working.
A good example is the code for logging in and out on a onClick event. See code below.


$w.onReady( function () {
//log in text
if (wixUsers.currentUser.loggedIn === true ){
$w(‘#loginSignup’).text = “Log Out”;
let user = wixUsers.currentUser;
let userId = user.id; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user.loggedIn; // true
user.getEmail()
.then( (email) => {
let userEmail = email; // “user@something.com
$w(‘#emailLogin’).text = userEmail;
} );
//end of if statement

}  **else**  { 
    $w('#loginSignup').text = "Log in/Sign up"; 
    $w('#emailLogin').hide(); 
} 

// notification message that you are logged in.
console.log(“I’ve viewed login button press”);
if ($w(‘#loginSignup’).text === “Log Out”) {
$w(‘#loggedIn’).show();
$w(‘#emailLogin’).show();
$w(‘#loggedIn’).text = “You are logged in!”
setTimeout(() =>{
$w(‘#loggedIn’).hide(“float”, floatOptions);
$w(‘#emailLogin’).hide(“float”, floatOptions);
console.log(“Show email and notification then hide”);
}, 3500);

    }  **else**  { 
        $w('#loggedIn').hide(); 
        $w('#emailLogin').hide(); 
        console.log("No Show of email or notification"); 
    } 

}


This code works on my actual Web Browsers but for my Mobile Browser, nothing is executing.
Please help Wix Community and Wix Team.

Best,
Nino

Hi, Nino.
Could you please specify your site where it’s happening? It doesn’t seem this part of code contains errors.

Hi, Ihor.

I created the code on the web interface but for the mobile interface it doesn’t work. Wanted to know if there was a problem with the code not working on the mobile phone but on the website it works (using laptop or computer)

@nino sorry for delay, but as I mentioned before it doesn’t seem like your code contains errors, so I need a link to your site where this code is present

1 Like

@ihor-khudik Hi Ihor I have fixed the issue. Made another way of logging in and not as difficult as the one you see above. I appreciate you getting back with you on this issue.