How-to: Debug Javascript in Internet Explorer (step by step)

Source: Internet
Author: User

The best tool for debugging JavaScript on Internet Explorer is the Microsoft Script Editor. A free component of Microsoft Office XP/2003. there are other options, but they are less attractive: Microsoft Script debugger is not very powerful, and Visual Studio. net is an expensive purchase if all you need is JavaScript debugging for IE.

Microsoft Script Editor is a powerful debugging tool, but getting it to work takes a bit of doing. the following is a quick guide. I 've also included a slideshow (hosted on slideapps.net) that shows the details of how to configure IE.

(Note: If you have any problems viewing the presentation, please submit a comment below. I'm trying out a new way of sharing PowerPoint .).

0) Turn debugging on in IE

Go to tools-> Internet Options-> advanced. Make sure that "disable script debugging (other)" and "disable script debugging (Internet Explorer) are not checked.

1) Get Microsoft Script Editor
Install Office 2003 or Office XP, if you don't have it already.

Check that you have it by selecting view-> script debugger-> open from IE. if you have Script Editor, then you'll be offered the choice of "new instance of Microsoft Script Debugger" or "new instance of Microsoft Script Editor ". otherwise, you'll just see "Microsoft Script Debugger ".

If you see that, then you have script editor installed. Congratulations!

2) using Microsoft Script Editor to debug
In general it is easiest to launch the editor from IE (rather than launching it as a stand-alone application ). one handy way to debug is to use IE view-> script debugger-> break at next statement.

This causes the debugger to activate the next time any JavaScript executes. If you then select "step into code" (F11) the Javascript file that contains the code will load automatically.

Alternately, you can put a line like this in your JavaScript code.
Debugger;

It will create a breakpoint automatically (in venkmen debugger as well as Script Editor ).

When this breakpoint gets hit, your debugger will launch. You will see a message that says "An exception 'runtime error' has occurred in script. Possible debuggers :".

Don't fret, nothing has gone wrong. select Microsoft Script Editor from the list.

Now you're debugging! Simply step through the code, the way you wowould in Venkman.

3) after you're done
Special care needs to be taken to clean up when you're done debugging, otherwise IE (and possibly the entire operating system) will hang. I recommend F5 (to continue), removing all breakpoints if that is necessary. you need to make sure that the browser isn' t waiting for the debugger. then shut down the debugger. when it asks you if you want to stop debugging, say "yes ".

4) related articles/further reading
An article on IE debugging from Microsoft

Debugging JavaScript using Visual studio.net

Debugging JavaScript using Microsoft Script Debugger

The best JavaScript debugger (for Firefox, naturally) is Venkman.

The viewrenderedsource Firefox extension makes troubleshooting your DOM tree a snap.

A nice blog article on the Microsoft Script Editor

A great Installation Guide to Microsoft Script Editor

SubscribeTo orBookmarkThis site.

See the original link, Http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.