Is there any way to determine whether a web app is running in dev mode or as a properly published version?
I tried getting the URL at both front and back ends.
If I query
window.location.href
at the front end I don't get the URL displayed in the page address bar, which ends in /dev or /exec. Instead I get a URL that ends in /userCodeAppPanel - I'm guessing because it's been sanitized.
If I call the backend
ScriptApp.getService().getUrl()
and pass it to the front end it always shows the /exec URL, even if the script is in /dev mode.
I wanted to set DEBUG flags on or off depending on which mode the script was running in.
Any ideas? Thanks.
I had the need to determine if the script is in dev mode as well and couldn't find a solution either. But here's a work around that would work. It requires a manual step every time you publish a production version.
During development:
Before publishing:
After publishing:
This would allow segmentation of resources used by dev and production versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With