Hi
I have few simple pages, and before anyone gets in, I want to redirect him to another page asking for a password. I don’t want him to see their content before he inserts password at the second page.
I made it and it works fine. The problem is that it takes few seconds and meanwhile the man can see the first page.
I assume that if I put the code before onReady() it can work better, but I didn’t find anywhere I can write it.
Any ideas?
my code:
$w.onReady( function () {
let pass = local.getItem(“password”);
if (pass !== “ok”){ // no coockie
session.setItem(“prevPage”, wixLocation.url);
wixLocation.to(“www.askPassword.com”);
}
});
www.askPassword.com
…
local.setItem(“password”, “ok”);
let url = session.getItem(“prevPage”);
wixLocation.to(url);