One time lightbox code not working at all

Hi All

I am trying to make a light box on my page display only once to each user. I have read the support page here: Velo Tutorial: Creating a One-Time Popup | Help Center | Wix.com

However when I apply the code it doesn’t work and I have tried lots of variations but to no effect.

I’m sure i’m missing something completely obvious but is someone able to help out here please?

Thanks,
Sam

Hi Sam,
Have you checked if the item was actually saved on your local storage? If you’re not sure how to do it, you can check out the explanation here .

Tal.

I’m having the exact same problem. It appears that an entry was made in my local storage, but the lightbox appears each and every time, not remembering that I was already at the page. Open a new tab, and it’s there again. I’ve used the exact code from the tutorial page (with the exception of using my lightbox name).

Any suggestions?

Has anyone found a fix for this code not working? I’m having the same problem. I am doing everything exactly according to the Wix instructions on this page: Velo Tutorial: Creating a One-Time Popup | Help Center | Wix.com but it doesn’t work at all anymore.

It actually used to work when I first bought my site, but not at all anymore.

Can it be that your browser settings are set to block storage? (or you’re using private/incognito window?)

Try using local.getItem instead of !local.getItem.

@jonatandor35 I’d already thought of that … nope, it’s not the problem. But thank you.

I’ll give that a try.

No, that didn’t work.

@plusmentorship Interesting. Would you mind creating an empty box pinned to screen and plug it into your code instead of the lightbox? That might isolate whether the problem is something else in your code like having multiple iterations of the same cookie or something wonky with the lightbox.

@skmedia I’m not sure what that was supposed to do. I did that, but it didn’t work as well (Lightobx repeatedly showed up on page on refresh). And I am not sure what “wonky” there could be in a lightbox, since it was simply made in the Wix editor––no extra coding, etc.

@plusmentorship Lightbox is much more inefficient at loading than a box, so that rules out rendering errors. Do you have other places on your site where you’ve set local cookies or is that the only one?

1 Like

@skmedia that’s the only page that I’ve added the “one time pop-up” code to. But, in terms of “where you’ve set local cookies” I don’t understand the question. I, specifically, am not setting up cookies for my site. I’ve put the GDPR notice on my site because Wix sets a huge amount of cookies.

@plusmentorship When you use local.setITem and session.setItem, these are also cookies.

@skmedia I see, thank you for the clarification. So the alteration to “local.getItem” without the “!” didn’t change anything. But I appreciate you trying to help.