Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you log to Firebug from an extension?

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?

like image 314
Robin Rodricks Avatar asked Jul 25 '09 19:07

Robin Rodricks


People also ask

How do I use Firebug extension?

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.

How do I get firebug on Firefox?

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.

What is firebug debugging tool?

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.


2 Answers

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);
like image 172
robr Avatar answered Oct 20 '22 01:10

robr


To log to the console from inside a firefox extension’s javascript:

Application.console.log("Hello from my Firefox Extension!");

like image 21
Elankeeran Avatar answered Oct 20 '22 01:10

Elankeeran