So I need to check some results in a Firefox add-on I'm working on, however the console.log() does not work. I've tried simply putting,console.log("Hello World");
in the main.js file and loading it, but it doesn't log anything.
You can open the Browser Console in one of two ways: from the menu: select “Browser Console” from the Browser Tools submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). from the keyboard: press Ctrl + Shift + J (or Cmd + Shift + J on a Mac).
The Web Console:Logs information associated with a web page: network requests, JavaScript, CSS, security errors and warnings as well as error, warning and informational messages explicitly logged by JavaScript code running in the page context.
By default the minimum log level is error
. Everything else is not printed, and that includes console.log()
. Please see the Log Levels
for more information on how to use and configure logging and associated levels.
If you are working on an extension/addon (not SDK), simply import the Console.jsm
and then the console.log()
will work normally. That is what I do.
Components.utils.import('resource://gre/modules/devtools/Console.jsm');
Update: As of Firefox 44+
Components.utils.import('resource://gre/modules/Console.jsm');
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