160

I need to debug JavaScript in Internet Explorer 7.

Unfortunately, its default debugger doesn't provide me with much information. It tells me the page that the error showed up on (not the specific script) and gives me a line number. I don't know if that is related to my problem.

It'd be nice if it could narrow down the error to a line number on a specific script (like Firebug can).

Is there an addon to debug JavaScript in IE7 like Firebug does in Firefox?

Thank you!

See also:

Does IE7 have a “developer mode” or plugin like Firefox/Chrome/Safari?

0

18 Answers 18

90

Web Development Helper is very good.

The IE Dev Toolbar is often helpful, but unfortunately doesn't do script debugging

9
  • 4
    Worth noting, perhaps, is that you have to turn "disable debugging" off in the advanced options. Aug 25, 2011 at 18:45
  • 24
    I don't see any script debugging options in the IE Dev Toolbar, and the lastest version of Web Development Helper isn't working, even after changing my advanced preferences and restarting IE7.
    – stevebot
    Aug 30, 2011 at 16:14
  • 9
    The Web Development Helper link given above is defunct. Can anyone confirm that this is the same tool hosted here? softpedia.com/get/Tweak/Browser-Tweak/…
    – RMorrisey
    Oct 3, 2012 at 14:20
  • 3
    Oh the irony; The softpedia download link for Web Dev Helper dies in IE7! (The dreaded "Operation Aborted" error.) Apr 17, 2013 at 17:19
  • 1
    I think the link leads to malware.
    – tree
    May 3, 2013 at 15:35
41

The hard truth is: the only good debugger for IE is Visual Studio.

If you don't have money for the real deal, download free Visual Web Developer 2008 Express EditionVisual Web Developer 2010 Express Edition. While the former allows you to attach debugger to already running IE, the latter doesn't (at least previous versions I used didn't allow that). If this is still the case, the trick is to create a simple project with one empty web page, "run" it (it starts the browser), now navigate to whatever page you want to debug, and start debugging.

Microsoft gives away full Visual Studio on different events, usually with license restrictions, but they allow tinkering at home. Check their schedule and the list of freebies.

Another hint: try to debug your web application with other browsers first. I had a great success with Opera. Somehow Opera's emulation of IE and its bugs was pretty close, but the debugger is much better.

5
  • 2
    for step-by-step instructions, see @mitjak's answer
    – rymo
    Mar 23, 2012 at 19:35
  • 4
    VS is not the only good debugger for IE, although I agree there are not many good ones. This is the one IE-specific javascript debugger I've been using for years, although it's not free: javascript-debugger.com
    – user1583439
    Sep 21, 2012 at 19:12
  • Link to VS 2008 is gone. Now it goes to a page for VS 2012. Apr 22, 2013 at 18:31
  • There is VS 2012 Express Edition, which is still free (the old link actually points to it). Apr 23, 2013 at 8:21
  • 1
    VS2012 Express requires Windows 7. If you're trying to debug IE7, that's not helpful. What you need is VS2010 Web Express: microsoft.com/web/gallery/…
    – Mike Post
    Oct 2, 2013 at 0:04
32

you might want to try microsoft script debugger it's pretty old but it's quite useful in the sense if you stumble on any javascript error, the debugger will popup to show you which line is messing up. it could get irrating sometimes when you do normal surfing, but you can turn if off.

here's a good startup on how to use this tool too. HOW-TO: Debug JavaScript in Internet Explorer

2
27

I've found DebugBar.

Not as good as Firebug, but close.

3
  • 3
    still, way better than ie dev toolbar Jan 23, 2009 at 0:37
  • 2
    I don't know why this isn't the accepted answer. By far better than any other debugger for IE.
    – Tres
    Nov 15, 2011 at 3:38
  • 1
    I actually found the free "Companion JS" mentioned on their site to work best. It tells you exactly which JS file & line number the error occurs on.
    – Tyler
    Nov 26, 2012 at 16:29
25

In IE7, you can bring up firebug lite for the current page by pasting the following in the address bar:

javascript:var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);

See http://getfirebug.com/lite.html.

4
  • 6
    Firebug lite doesn't do Javascript
    – Casebash
    Jan 25, 2012 at 3:56
  • I stopped at FireBug lite with its console to debug Jul 1, 2013 at 12:09
  • It does have a console that runs JavaScript, which is what I was looking for.
    – Alex W
    Sep 30, 2013 at 17:23
  • Really useful to inspect elements on IE 7. Thanks! :) Jan 22, 2014 at 15:36
7

Microsoft Script Editor is indeed an option, and of the ones I've tried one of the more stable ones -- the debugger in IE8 is great but for some reason whenever I start the Developer Tools it takes IE8 a while, sometimes up to a minute, to inspect my page's DOM tree. And afterwards it seems to want to do it on every page refresh which is a torture.

You can inspect contents of variables in Microsoft Script editor: if you poke around under Debug > Window you can turn on local variable inspection, watching etc.

The other option, Visual Web Dev, while bulky, works reasonably well. To set it up, do this (stolen from here):

  1. Debugging should be turned on in IE. Go into Tools > Internet Options > Advanced and check that Disable Script Debugging (Internet Explorer) is unchecked and Display a notification about every script error is checked
  2. Create a new empty web project inside of VWD
  3. Right-click on the site in the Solutions Explorer on the top right, go to Browse With and make sure your default browser is set to IE (it's reasonable to assume if you're a web developer IE is not your default browser in which case that won't be the default.. by default)
  4. Hit F5, IE will open up. Browse to the page you want to debug.
  5. VWD will now open up any time you have a script error or if you set a breakpoint in one of the JS files. Debug away!

UPDATE: By the way, if you experience the same slowdowns as me with IE8's otherwise decent debugger, there is a workaround -- if you encounter or make IE encounter an error so that it pops up the "Do you want to debug" dialogue and hit Yes, the debugger will come up pretty much instantly. It seems like if you go "straight" into debugging mode the Dev Tools never inspect the DOM. It's only when you hit F12 that it does.

2
  • I'd have to test this out some more but so far it seems like the IE8 debugger works faster when browsing in compatibility mode. Go figure!
    – dmkc
    May 15, 2009 at 16:48
  • 1
    If you're using the Express (free) version of VWD, make sure you've closed ALL IE windows before step 4 - VWD has to be the one to start IE fresh so that it "owns" it.
    – rymo
    Mar 23, 2012 at 19:39
3

IE8 has much improved developer tools. Until then it's best to write javascript for firefox first and then debug IE using alert() statements.

3
  • Can't wait for IE8 (so long as it lives up to the hype - I've yet to download the beta)
    – alex
    Dec 12, 2008 at 2:19
  • Now that it's out I've udpated, and I must say that I like the debugger even better than firebug's :) Mar 31, 2009 at 21:38
  • @Joel, although the debugger is great - one thing that annoys me (that Firebug has) is a right click context menu where you can choose "inspect element". To my knowledge, in IE8 you have to launch the developer tools, then click the arrow, then find the element you want to inspect.
    – alex
    Sep 3, 2009 at 0:33
3

Microsoft Script Editor can be used to debug Javascript in IE. It's less buggy than Microsoft Script Debugger but has the same basic functionality, which unfortunately is pretty much limited to stepping through execution. I can't seem to inspect variables or any handy stuff like that. Also, it only shipped with Office XP/2003 for some bizarre reason. More info here if you're game.

I downloaded the Visual Web Developer 2008 Express Edition mentioned by Eugene Lazutkin but haven't had a chance to try it yet. I'd recommend trying that before Script Editor/Debugger.

3

It's not a full debugger, but my DP_DEBUG extensions provides some (I think) usful functionality and they work in IE, Firefox and Opera (9+).

You can "dump" visual representations of complex JavaScript objects (even system objects), do simplified logging and timing. The component provides simple methods to enable or disable it so that you can leave the debugger in place for production work if you like.

DP_Debug

2

The IE9 developer tools worked for me. Just set the "Browser Mode" menu item to IE7.

2
  • 7
    This is useful, but the emulated IE7 isn't quite the same.
    – alex
    Feb 23, 2012 at 2:19
  • I guess it depends. If I can reproduce an issue in IE9's emulated mode, then I'll fix it there. Otherwise, Firebug Lite is a good solution - though you'll need to have IE7 installed somewhere. Mar 1, 2012 at 1:28
1

Hey I came across the same problem and found this the application IETESTER. It's pretty awesome, it's an app that has IE 5.5,6, and 7 bundled into it. It doesn't matter what IE version you currently have. This allows you to have multiple versions side by side.

If you enable javascript debugging in IE options and have Visual Studio installed you can even debug the javascript in VS with all the debug options available to you(watches, conditional breakpoints ,etc.)

If you want to start debugging before an error occurs you simply have to put the line

debugger;

into your JS code and this bring you into VS to begin debugging after this statement.

This is absolutely amazing to me for testing backward compatibility for JS code.

0

Use Internet Explorer 8. Then Try the developer tool.. You can debug based on IE 7 also in compatibility mode

9
  • 17
    IE7 != IE8 compat mode. There are incompatibilities.
    – thorn0
    Jan 7, 2010 at 21:32
  • 1
    +1 At least IE8 tells you the file name of the script that's causing the error. Jan 22, 2010 at 15:16
  • @thorn, but there is an IE7 mode. (Maybe there wasn't, before?) So: regular, compatibility mode, IE7 mode.
    – ANeves
    Mar 15, 2011 at 15:23
  • 1
    @ANeves it's just different names for the same thing
    – thorn0
    Mar 15, 2011 at 15:44
  • 4
    @ANeves Looks like "IE7 mode" is just "compatibility mode" with a user agent changed to that used by IE7. But I want to emphasize again that the compatibility mode isn't that compatible. E.g., reseting a style property via jQuery looks like this in IE7 (and other browsers): $my.css('z-index', null). In IE8, this code throws an error, even in the so called compatibility mode. So I had to write a code like this: $my.css('z-index', ie8 ? 'auto' : null)
    – thorn0
    Mar 18, 2011 at 18:41
0

FireBug Lite: http://getfirebug.com/firebuglite

3
0

The answer is simple.

  1. Get Internet Explorer 9
  2. Press F12 to load up Developer Tools
  3. Switch the browser mode to IE7

switching the browser mode on IE9

2
  • 6
    Because it's unreliable :( All open tickets in my current project connected to IE7 are not reproducible in Vista of Windows 7
    – AlfeG
    Nov 11, 2012 at 14:44
  • 4
    Could be helpfull, if the error is reproducable. But there are some errors, that do not occur in the IE9 with IE7-mode, but in original IE7 (same for IE8)
    – yunzen
    Dec 21, 2012 at 11:29
0

Running your code through a Javascript static analysis tool like JSLint can catch some common IE7 errors, such as trailing commas in object definitions.

0

IE8 Developer Tools are able to switch to IE7 modeenter image description here

0

If you still need to Debug IE 7, the emulation mode of IE 11 is working pretty well.

Go to menu: Dev Tools, then to emulation and set it. It also gives error line information.

-1

The following tools works great for me:

1) http://www.debugbar.com/

Provide a convenience UI to with feature like source, style, DOM, Script, HTML check. It also show the actual error in your JS file (which line, which file).

2) http://www.my-debugbar.com/wiki/CompanionJS/Installing

Provide a console for IE6 or IE7 ( which originally does not support)

  • Screenshot

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.