It's simple. You just call `window.console.log` or just `console.log`. Here's an example:
console.log("%d ways to skin a cat.", 101);
For more information on
console.log, visit the FireBug documentation.
I upgraded to FireBug 0.4 and
printfire no longer works!
printfire is no longer supported. Use
console.log() instead. Unlike with
printfire, you do not have to add any code to your scripts to use
But what about Internet Explorer?
It's true, FireBug works only in Firefox. Your logging statements won't cause errors in other browsers, but they won't show up either. Not to worry - the future holds two possible solutions!
One, we implement a FireBug extension for Internet Explorer and other browsers. This is probably not going to happen, which brings us to the more practical solution...
Sometimes XMLHttpRequests don't work when I am using FireBug. Why not?
There are some conditions in which FireBug causes XMLHttpRequests to fail. Unfortunately, this is due to bugs in Firefox itself, and I have yet to discover a workaround. There are two circumstances in which your requests won't work while using FireBug:
- When using synchronous XMLHttpRequests. That is, if you pass
falseas the third parameter to
- If your HTML document is loaded as XML, otherwise known as XHTML.
Some elements are hard to "pick" with the mouse. Can the keyboard help me out here?
It sure can! Using the arrow keys you can move around to elements adjacent to the one that is selected.
- Up - goes to the parentNode
- Down - goes to the firstChild
- Left - goes to the previousSibling
- Right - goes to the nextSibling
Some of the errors in the console seem to come from other pages. What gives?
Bug 228205 affects the accuracy of FireBug's error reporting. It is not actually possible to determine which window or tab an error comes from, therefore, FireBug currently appends errors to all consoles that are presently visible.
The way we guess is by showing you errors that occurred while a particular window is visible. So if you're looking at Page A, and Page B is in another tab or window, you'll see errors from Pages A and B. If you then bring Page B to the foreground, you will see an empty console.
When I change options in the menu, nothing happens. Why not?
Changes to the options affect future logging and errors as they stream in.