Preview Mode vs Publishing Mode

Good Afternoon

My question my seem to be amateurish, but I am very new to a Percussion Development

I understand that the sites/templates you develop in Rhythmyx have to be synchronized in both the Preview Mode and after they are published

So when developing a template in the Workbench, is there a way to figure out what mode you’re in, so you can adjust your Velocity, JavaScript or paths to your styles. I understand that I can do it by reading the current URL, but it seems to me like a dirty workaround

Is there a way in Rhythmyx (a JEXL Expression, binding variable or something else) to find out if you’re in a Preview Mode or the Publishing Mode

Please let me know if I made everything clear and thank you for your generous responses

Not sure of your approach, but you can try:

#if($rx.asmhelper.getSingleParamValue($sys.params, “sys_context”)==“0”)
I’m in preview
#else
I’m not in preview
#end

Thank you very much for your answer

By reading URL I meant using JavaScript’s window.location. If there is port specified or not

If you want the context param from the URL, it’s “sys_context.”

sys_context=0 is preview
sys_context=1 is publish