Javascript is great when it works. When it doesn’t work, it can get you from happy to miserable in less time than it takes you to say XmlHttpRequest.
Today I just found (via Ajaxian) an interesting tool that I’m adding to my arsenal when it comes to figuring out what’s happening in javascript. Definitely an invaluable debugging tool. It is called JavaScript Shell. When you embed the script, you get a command line window where you can make javascript calls directly from inside your web page.
You can call any method, inspect objects (using props), see where DOM objects are (using blink), and the killer feature, in my view, is the autocompletion using the tab key! It also features a command history, which is very convenient to try variations of the same call.
And if that wasn’t enough, you can also use the script as a bookmarklet. There is a Firefox version, and an Internet Explorer version available from Curiosity is bliss (ported to IE by Julien Couvreur).
You should try the script for yourself.
This is a great tool to debug, or even try a few things quickly and this will be a good complement to the rails console. It sure beats having to reload the page!
Hi Pascal,
Glad this was useful to you.
Since you mention XmlHttpRequestion, I’d recommend that you try my IE port of an AJAX debugging script I wrote last year. It’s also a bookmarklet, that you can grab at: http://blog.monstuff.com/archives/000291.html
Cheers,
Julien
Thank you, Julien! I did also see your post about XmlHttpRequest and I was planning to give it a try before I blogged about it ;)
You have a lot of great stuff on your blog, anyone reading this should really take a deep look (as I did).
This was cool, but it could have done a lot more. I did a similar implementation and I was planning on making it the best until FireBug came out with a great JS console implementation. If you use Firefox, FireBug is the way to go. : )
Indeed, Firebug is pretty cool, and so is JavaScript Debugger for Firefox. And for IE, I have had good success with MSE 6.0 I believe it is (from Microsoft).
But a script like Java Console is a worthy addition to your arsenal. If one tool fails, an other might work. Plus no complicated setup.