Open the Internet Explorer settings and select the Advanced tab. In the list of available options find the “Disable Script Debugging (Internet Explorer)” setting and make sure it’s unchecked.
Open any script you want to debug and place the following just before the statement where you want to start your debugging session:
That’s all, no semicolon, nothing else. To test it, run your form from the designer (preview mode) or publish it first. Once the script engine reaches the debugger statement, a list with all available debuggers is presented to you, including the Microsoft Script Debugger, Visual Studio 2003, Visual Studio 2005 or whatever is registered as a script debugger on your machine. You should try all debuggers to find the one you’re most comfortable with and mark it as the default.
Like any other statement, you can simply comment out the debugger statement, so
will actually turn off debugging.
All users that have not unchecked the “Disable debugging” setting in IE will not be prompted to start a debugger. However, you should make sure that you remove these statements before publishing them to a production environment. The easiest way to ensure it is to export all customizations and search the export xml file for “debugger”.
For more information about the debugger statement, see this link.