Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear Firefox' console via javascript?

I have some functions that when executed show some info with console.log().

There is no problem with that.

But, some times, the console looks strange... Because that, they sent me to clear the console when pressing 'l' (letter 'L' in lowercase).

I took it as a simple task, I just needed to use console.clear() and all would be fine.

But... I only thought:

console.clear(); // doesn't work in firefox !!!

In chrome it works fine.

Fiddle here.

Does someone knows any technique to do this in firefox?

Thanks for your time.


1 Answers

Console is not standarized so they will have differences. Firefox offers some helper commands though:

clear()

(same as hitting CTRL + L in Chrome, and ALT + R in Firefox).

However, you can not call it programmatically. Only works in console itself. You could look into Firebug instead as an option.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!