使用 JavaScript 清除 Firefox 中的控制台
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25924299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Clear the console in Firefox using JavaScript
提问by Michael Schwartz
Is there a way to clear the console in Firefox?
有没有办法清除 Firefox 中的控制台?
In Chrome I can use...
在 Chrome 中,我可以使用...
console.clear()
(Not sure if it works for Safari or Opera though)
(但不确定它是否适用于 Safari 或 Opera)
However I haven't been able to find a solution for Firefox. Is this type of API not yet available? Is there a workaround that doesn't require?
但是,我一直无法为 Firefox 找到解决方案。这种类型的 API 还没有吗?是否有不需要的解决方法?
console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
采纳答案by Todd Mark
In firefox you can just input clear()
. It well be done.
在 Firefox 中,您只需输入clear()
. 做得很好。
Here's a link to the Developer's website for Javascript console commands: http://msdn.microsoft.com/en-us/library/windows/apps/hh696634.aspx
这是 Javascript 控制台命令的开发人员网站的链接:http: //msdn.microsoft.com/en-us/library/windows/apps/hh696634.aspx
回答by Shayan Ahmad
Keep it simple silly. Better press "Ctrl +Shift +L" to clear the output in Firefox 44+. Whereas in previous versions and in Chrome press "Ctrl + L".
保持简单愚蠢。最好按“Ctrl + Shift +L”清除 Firefox 44+ 中的输出。而在以前的版本和 Chrome 中,按“Ctrl + L”。
回答by Gerard Reches
For anyone who comes to this question, console.clear()
works in Firefox since version 48.0.
对于任何遇到此问题的人,console.clear()
自48.0版起可在 Firefox 中使用。
回答by Yusril Maulidan Raji
回答by aemonge
I've been looking for future implementations of firefox, but still they don't want to implement it. So basically you can't in webconsole, but you can in firebug.
我一直在寻找 firefox 的未来实现,但他们仍然不想实现它。所以基本上你不能在 webconsole,但你可以在firebug。
See: https://developer.mozilla.org/en-US/docs/Web/API/console
请参阅:https: //developer.mozilla.org/en-US/docs/Web/API/console