how to write text to Mozilla JavaScript Console

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek_Bennett

    #1

    how to write text to Mozilla JavaScript Console

    I would like to find out how to write out messages to the Mozilla
    JavaScript Console. This would allow me to have a client-side record
    of execution which would be ideal in debugging end-user problems.

    I am looking for something like
    javascript:mozi lla.jsconsole.m essages.write(" some debug string");
  • Keith Bowes

    #2
    Re: how to write text to Mozilla JavaScript Console

    Derek_Bennett wrote:[color=blue]
    > I would like to find out how to write out messages to the Mozilla
    > JavaScript Console. This would allow me to have a client-side record
    > of execution which would be ideal in debugging end-user problems.
    >
    > I am looking for something like
    > javascript:mozi lla.jsconsole.m essages.write(" some debug string");[/color]

    I think it's
    dump("some debug string");

    But you have to enable it in about:config

    Again, this is strictly IIRC

    Comment

    • Derek_Bennett

      #3
      Re: how to write text to Mozilla JavaScript Console

      Keith Bowes <do.not@spam.me > wrote in message news:<SXVRb.152 98$dF4.3192@fe0 2.usenetserver. com>...[color=blue]
      > Derek_Bennett wrote:[color=green]
      > > I would like to find out how to write out messages to the Mozilla
      > > JavaScript Console. This would allow me to have a client-side record
      > > of execution which would be ideal in debugging end-user problems.
      > >
      > > I am looking for something like
      > > javascript:mozi lla.jsconsole.m essages.write(" some debug string");[/color]
      >
      > I think it's
      > dump("some debug string");
      >
      > But you have to enable it in about:config
      >
      > Again, this is strictly IIRC[/color]

      You recall incorrectly, it seems.
      There is no mention of any similar setting in about:config.
      I was unable to call javascript:dump ("blah") from the address bar or
      the JSConsole evaluate bar.

      If you have any other information, I would be glad to hear it!

      Comment

      • Martin Honnen

        #4
        Re: how to write text to Mozilla JavaScript Console



        Derek_Bennett wrote:
        [color=blue]
        > I would like to find out how to write out messages to the Mozilla
        > JavaScript Console. This would allow me to have a client-side record
        > of execution which would be ideal in debugging end-user problems.
        >
        > I am looking for something like
        > javascript:mozi lla.jsconsole.m essages.write(" some debug string");[/color]

        You need XPConnect privileges to do that e.g. try the following from
        file: URL and grant the privilege when prompted:

        netscape.securi ty.PrivilegeMan ager.enablePriv ilege('Universa lXPConnect');
        var jsConsoleServic e =
        Components.clas ses['@mozilla.org/consoleservice; 1'].getService();
        jsConsoleServic e.QueryInterfac e(Components.in terfaces.nsICon soleService);
        jsConsoleServic e.logStringMess age('Kibology for all.')

        Then the message should appear in the JavaScript console. However
        requesting privileges from http: URL is with normal browser settings
        only possible if the script is signed.
        --

        Martin Honnen
        http://JavaScript.FAQTs.com/

        Comment

        Working...