Error Console

From MozillaZine Knowledge Base

Revision as of 10:34, 16 January 2005; view current revision
←Older revision | Newer revision→

This page is part of the extension development documentation project.

Ask your questions in MozillaZine Forums. Also try browsing example code.

Note: development documentation is in process of being moved to Mozilla Development Center (MDC).

You can print information to JavaScript Console using the following method:

  1. Declare a variable (global if you're scripting your own window or your object's member if you're overlaying an existing window):
    var gConsoleService = Components.classes[';1']

    (note, that you can use toJavaScriptConsole() function to open JavaScript console on startup)

  2. Define a function:
    function myExt_logMessage(aMessage) {
      gConsoleService.logStringMessage('My extension: ' + aMessage);
  3. Use it like here:

See also: Viewing dump() output, Using Console service.