Lightbox to open only on mobile (not working)


I would like a lightbox to display when viewing the website on a mobile to say “We recommend using a desktop to maximise your experience. To continue viewing our site on your mobile, close this window”

I have set up the lightbox in desktop view and added the following to site code…

$w.onReady(function () {
 if (wixWindow.formFactor === "Mobile") {

However, the lightbox is not displaying when viewed on a mobile.

Any suggestions?


Hi @rachelskuse ,

Here is a few tips:

  1. Please check that lightbox name is correct - same one that you see in the settings panel (in my case mobileBox )
  2. Please see that you did an import for wixWindow [ import wixWindow from ‘wix-window’;]
  3. In case that you want to show this lightbox on redirect to home/specific page - be sure that this part of code was added there, otherwise it should be added to SITE section.
  4. Disable the auto-display option

Please see if it helps.


1 Like

Plus, if not done so already, make sure that you have read the support pages on it as it describes how to do it perfectly.

Thank you, I was using the name as specified in Property ID not in the settings panel so all working now :slight_smile: