如何通过javascript清除Firefox的控制台? [英] How to clear Firefox' console via javascript?

查看:334
本文介绍了如何通过javascript清除Firefox的控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些功能,当执行时显示一些信息与 console.log()



没有问题。 / p>

但是,有些时候,控制台看起来很奇怪...因为那样,当按'l'(小写字母'L')时,他们发送我清除控制台。



我把它作为一个简单的任务,我只需要使用 console.clear(),一切都会很好。

但是...我只想:

  console.clear //不工作在Firefox! 

在chrome中它工作正常。



小提琴在这里



有人知道任何技术在firefox中执行此操作



感谢您的时间。

解决方案

控制台没有标准化,所以它们会有区别。 Firefox提供了一些帮助程序命令

  clear()

(与在Chrome中点击 CTRL + L 和在Firefox中点击 ALT + R 相同)。



但是,不能以编程方式调用它。只适用于控制台本身。您可以改用 Firebug 作为选项。


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.

解决方案

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.

这篇关于如何通过javascript清除Firefox的控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆