how to write text to Mozilla JavaScript Console

D

Derek_Bennett

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:mozilla.jsconsole.messages.write("some debug string");
 
K

Keith Bowes

Derek_Bennett said:
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:mozilla.jsconsole.messages.write("some debug string");

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

But you have to enable it in about:config

Again, this is strictly IIRC
 
D

Derek_Bennett

Keith Bowes said:
I think it's
dump("some debug string");

But you have to enable it in about:config

Again, this is strictly IIRC

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!
 
M

Martin Honnen

Derek_Bennett said:
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:mozilla.jsconsole.messages.write("some debug string");

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

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var jsConsoleService =
Components.classes['@mozilla.org/consoleservice;1'].getService();
jsConsoleService.QueryInterface(Components.interfaces.nsIConsoleService);
jsConsoleService.logStringMessage('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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top