How to conditionally add Javascript code if you are in Visual Studio debug mode

Jump to: navigation, search

You can conditionally add Javascript code if you are in Visual Studio depending on whether you are running debug mode or release mode using the example below: Below assumes you are editing a .cshtml file that has a script block. This example may not work if the file is a .js @if (HttpContext.Current.IsDebuggingEnabled) { <text> //js code goes here. alert('I am running in debug mode'); </text> }else{ <text> //js code goes here. alert('I am running in release mode'); </text> }

See also

Use your Android as a remote for garage door

Personal tools
Namespaces
Variants
Views
Actions
Navigation