How to know if app is running in the Retool IDE as preview or on a public URL?

Hello,

Is there a variable that I can use to know if my app is running in the Retool IDE as preview or on a public URL?

Like globalthis.IsRunningInPreview?

Thanks!

something like retoolContext.inEditorMode, retoolContext.environment ?
If not, you can use urlparams.href and use regex to test the URL to make sure it contain /editor/ or /embedded/public/

https://***g.retool.com/editor/b97e9870-31a2-11e5df61/test
https://***g.retool.com/embedded/public/b8cb2a-d47c472dd2ba

1 Like

Thank you @AnsonHwang. retoolContext.inEditorMode did the trick.
Also like the idea of using regex to test the URL!

:grinning:

Patrick