Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you programmatically access the Firebug console output?

Is it possible to access the previously-logged output of Firebug programmatically?

For example:

console.log('a');
console.log('b');
console.log('c');

for (var i = 0; i < console.output.length; ++i) {
    alert(console.output[i]);  // "a", "b", "c"
}
like image 965
nickf Avatar asked Dec 07 '10 10:12

nickf


2 Answers

Paul Irish created a wrapper for console.log that should solve your problem, have a look here

like image 117
sebarmeli Avatar answered Sep 21 '22 16:09

sebarmeli


Without wrapping window.console yourself, I don't believe this is possible. Looking at the source, it seems that when a Firebug's console method (running within the main document and therefore having no special privileges) is called, it leaves some objects lying around in the main document and then raises a custom event. A Firebug listener running in privileged-plug-in-land picks up the event, gobbles up the objects left in the document and adds appropriate things to the console panel, which is part of the browser chrome and therefore inaccessible to JavaScript running in the main window.

I could be wrong about the details of this because I've only taken a cursory look at the Firebug source and done very little Firefox plug-in development, but I think this is broadly correct.

like image 38
Tim Down Avatar answered Sep 21 '22 16:09

Tim Down