How to detect a web app is in the preview mode?

Basically I need to know if a web app’s URL starts with;
Or better if there is a way to know an app (any app) is launched in a preview mode?

Well, in the meantime I used the following formula: CONTAINS(systemVars.initialUrl, "") to initialize an app variable accordingly when in preview mode.