Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging JavaScript in Internet Explorer and Safari

Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and Safari. In Firefox, you can use Firebug's logging feature and command Line functions. However, this doesn't help me when I move to other browsers.

like image 955
Eldila Avatar asked Aug 10 '08 09:08

Eldila


People also ask

How do I debug JavaScript on Mac?

not sure if in Windows is the same, but on the mac version you have a Developer menu ("Develop"), at the mac this menu is shown via the preferences > advanced > show develop menu, and there you can view items such as "Start debugging javascript".

Is there a debugger for JavaScript?

But fortunately, all modern browsers have a built-in JavaScript debugger. Built-in debuggers can be turned on and off, forcing errors to be reported to the user. With a debugger, you can also set breakpoints (places where code execution can be stopped), and examine variables while the code is executing.


1 Answers

For Safari you need to enable the "Develop" menu via Preferences (in Safari 3.1; see the entry in Apple's Safari development FAQ) or via

$ defaults write com.apple.Safari IncludeDebugMenu 1

at the terminal in Mac OS X. Then from the Develop menu choose Show Web Inspector and click on the Console link. Your script can write to the console using window.console.log.

For Internet Explorer, Visual Studio is really the best script debugger but the Microsoft Script Debugger is okay if you don't have Visual Studio. This post on the IE team blog walks you through installing it and connecting to Internet Explorer.

Internet Explorer 8 looks like it will have a very fancy script debugger, so if you're feeling really adventurous you could install the Internet Explorer 8 beta and give that a whirl.

like image 72
Dominic Cooney Avatar answered Oct 12 '22 13:10

Dominic Cooney