Genesys Source

Disallow in prod: alert() and response.write debugging

JS still requires a lot of alert() debugging. A quickie technique to stop that code from bleeding into Dev/qa/prod:

Put this in your _layout.cshtml or window.onload:

        function isDebug() {

            return @(HttpContext.Current.IsDebuggingEnabled);

        }

 Then use in your code:

        if (isDebug) { alert("customers do not want to see this"); }

 

Beware isDebug() is global with this implementation.

Happy coding!

Leave your comment