Detecting if the App is Running in Sizzy

To detect if your app is running in Sizzy, check if the window.__sizzy object exists.

Sizzy inserts the window.__sizzy object to the pages it renders. This is useful if you want to disable animations, switch a theme, do some A/B testing etc during development.

Think of it as a way to change code only in Sizzy and not in the actual codebase. You can use it to add custom logic for each device, such as colors, stylings, themes, etc. based on the device name or the device index

This is how a sample object looks:

JS

Example

If your app has 2 themes (say dark and light), you can test both of them simultaneously in Sizzy. Use this code to set the theme to dark for every other device. :

JS

As a demo, run this URL in Sizzy.

Document image

Here's the sample code for how to accomplish this.