About Testing Code in Preview Mode

You can use Preview mode to test most code on a site before publishing. You can perform actions in Preview mode that you would be able to perform on a live site. When testing a site, you can check if any errors appear in the Wix Developer Console.

Supported IDEs

Preview mode is available in Wix Studio and Wix Editor. If you're developing in the Wix IDE or the Local IDE, you can open a site in Wix Studio or Wix Editor to use Preview mode.

Differences between preview mode and published sites

Although you can view pages and interact with a site and data in Preview mode, the site doesn't behave exactly as it does when published:

  • When previewing a site, you are assigned the Admin role. That means you are granted all possible permissions. Users of a live site might have different permissions and therefore have more restricted access.
  • When previewing a site with sandbox enabled, you're working with the data in the site's optional sandbox database. Users of a live site work with the live database. Wix app collections, however, only have the live database version. Any changes you make to these collections in Preview mode are reflected in the published site.
  • Backend events and several other APIs don't necessarily work when previewing a site. These are noted in the API reference.

You can try out a test version of your published site on a small percentage of visitors using a test site. This is helpful for testing functionality that only works on a published site without exposing that functionality to all site visitors.

Handling errors

If you see errors or a site isn't running as expected, there are tools you can use to debug the code in the site.

Collections in preview mode

When you've finished previewing and return to the editor, interactions you had with a site aren't maintained. The site returns to the state it was in before you entered Preview mode. The only exception is collection data. Changes you make to collection data in preview persist even after you exit Preview mode.

See also

Did this help?