This is an archived page. It's not actively maintained.


Non-standard. Do not use!
The Debug object only works in Internet Explorer and Windows 8 and Windows Phone 8.1 Store apps.

The debug object is an instrinsic global object that sends output to a debugger.


You do not instantiate the Debug object. Its properties and methods are called off the Debug class.

There are different ways to debug Internet Explorer and Windows 8.x Store apps. In Windows 8.x Store apps, the write and writeln functions of the Debug object display strings in the Visual Studio Output window at run time.

To debug Internet Explorer scripts, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 and later versions include the JavaScript debugger.

If the script is not being debugged, the Debug methods and properties have no effect.


Async Callback Status Codes

Contant Description Value
Debug.MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE The synchronous work item assigned a callback or continuation to be run by an asynchronous operation. 0
Debug.MS_ASYNC_CALLBACK_STATUS_JOIN The synchronous work item satisfied part of a join asynchronous operation. 1
Debug.MS_ASYNC_CALLBACK_STATUS_CHOOSEANY The synchronous work item satisfied a choice asynchronous operation. 2
Debug.MS_ASYNC_CALLBACK_STATUS_CANCEL The synchronous work item was canceled. 3
Debug.MS_ASYNC_CALLBACK_STATUS_ERROR The synchronous work item caused an error in an asynchronous operation. 4

Async Operation Status Codes

Contant Description Value
Debug.MS_ASYNC_OP_STATUS_SUCCESS The asynchronous operation was successful. 1
Debug.MS_ASYNC_OP_STATUS_CANCELED The asynchronous operation was canceled. 2
Debug.MS_ASYNC_OP_STATUS_ERROR The asynchronous operation resulted in an error. 3


Determines whether debugging is enabled for the script context. Debugging may be enabled or disabled whether or not a debugger is attached.
Determines whether any try-catch blocks in this scope are to be treated by the debugger as user-unhandled.


Indicates that the callback stack associated with a previously specified asynchronous operation has completed.
Associates the callback stack with a previously specified asynchronous operation.
Indicates that an asynchronous operation has completed.
Initiates a trace for an asynchronous operation.
Updates the relationship status between a synchronous work item and the associated asynchronous operation.
Sends strings to the script debugger.
Sends strings to the script debugger, followed by a newline character.


This example uses the write function to display the value of the variable.

var counter = 42;
Debug.write("The value of counter is " + counter);


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1).

See also