I'm writing an extension for Firefox, and I need to log some data to Firebug's console. Within the scope of my addon, "console" is undefined, and "window.content.console" is also undefined. So how do I log to the console?
Installing Firebug You can download and install Firebug from https://addons.mozilla.org/en-US/firefox/addon/1843/. After visiting the page referenced above, click on the Download button, it shows a window to and click on the Install button there. It takes a while and asks you to restart the Firefox browser.
FireBug is an add-on which you can easily download from the FireFox plugin store. 1- Follow the menu option as Tools >> Web Developer >> Get More Tools. 2- The above action will lead you to a web page as shown in the below image. There you will find an option to download/install the FireBug add-on.
Firebug is a discontinued free and open-source web browser extension for Mozilla Firefox that facilitated the live debugging, editing, and monitoring of any website's CSS, HTML, DOM, XHR, and JavaScript.
Since you're not writing Javascript that executes within a window, console
is not defined.
So you need to reference the Firebug extension first:
Firebug.Console.log(str);
To log to the console from inside a firefox extension’s javascript:
Application.console.log("Hello from my Firefox Extension!");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With