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