I am interested in forcing a popup which cannot be closed if someone is visiting my site from a country that we do not offer services. The popup will notify the user and collect their email address if we do offer services in the future. Can you please advise how we can do this and apply it to all pages on my site?
You can do so with a lightbox and a bit of coding and settings.
The settings -
In the lightbox settings, shutdown the close button and the X button. At this moment, the lightbox will still close if someone clicks outside of the lightbox area.
The coding -
Using wix-window.openLightbox you can open the lightbox as per the conditions you are interested in, like geo. The function openLightbox returns a promise that is fulfilled whenever the lightbox closes - for instance if a user clicks outside of the lightbox area. You can at this moment open the lightbox again.
Another option is to, instead of using a lightbox, redirect the user to another page dedicated for those users. This page can be setup without a menu, no header or footer. You can then add logic in you page code to check the condition as above and using wix-location.to redirect to this page.
Thanks Yoav. Is there a function that I can call to get the IP address a user is browsing my WIX site from? Once I have that, I can run through an IP table and execute the wix-window.openLightbox function that you had mentioned.
Hi ron,
You don’t really need to know the address, see this thread of stack overflow to get some simple ideas on how to get the users country.
You can use the API of ‘wix-fetch’ to make the GET requests.
Liran.
I want to restrict sign up for countries other than India. I have used a lightbox to customize sign up. How can I disable sign up for other countries?