Determine if a Google Apps Script WebApp is running in /dev mode

Viewed 1002

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.

1 Answers
Related