問題描述
我想知道我是否可以用一些命令清理控制臺..
console.log()
,可以打印...有清除控制臺的命令嗎?..
我嘗試了 console.log(console);
并在下面得到了這個函數......
assert: function assert() { [native code] }構造函數:函數 Console() { [本機代碼] }計數:函數計數(){[本機代碼]}調試:函數調試(){[本機代碼]}目錄:函數目錄(){[本機代碼]}dirxml: 函數 dirxml() { [本機代碼] }錯誤:函數錯誤(){[本機代碼]}組:函數組(){[本機代碼]}groupEnd: 函數 groupEnd() { [本機代碼] }信息:函數信息(){[本機代碼]}日志:函數日志(){[本機代碼]}markTimeline: function markTimeline() { [native code] }配置文件:函數配置文件(){[本機代碼]}profileEnd: 函數 profileEnd() { [本機代碼] }時間:函數時間(){[本機代碼]}timeEnd: 函數 timeEnd() { [本機代碼] }跟蹤:函數跟蹤(){[本機代碼]}警告:函數警告(){[本機代碼]}__proto__: 對象
[我想沒有辦法清理控制臺...但我希望有人對我說...]
更新:
console.clear()
適用于所有瀏覽器
<塊引用>
更新:截至 2012 年 11 月 6 日,console.clear()
為 現已在 Chrome Canary 中提供.
<小時>
如果您在控制臺中鍵入 clear()
,它會清除它.
我認為沒有辦法以編程方式執行此操作,因為它可能會被濫用.(控制臺被某些網頁清除,最終用戶無法訪問錯誤信息)
一種可能的解決方法:
在控制臺中輸入 window.clear = clear
,然后您就可以在頁面上的任何腳本中使用 clear.
I was wondering if I could clear up the console with some command..
console.log()
, can print... is there a command to clear up console?..
I've tried to console.log(console);
and got this functions below...
assert: function assert() { [native code] }
constructor: function Console() { [native code] }
count: function count() { [native code] }
debug: function debug() { [native code] }
dir: function dir() { [native code] }
dirxml: function dirxml() { [native code] }
error: function error() { [native code] }
group: function group() { [native code] }
groupEnd: function groupEnd() { [native code] }
info: function info() { [native code] }
log: function log() { [native code] }
markTimeline: function markTimeline() { [native code] }
profile: function profile() { [native code] }
profileEnd: function profileEnd() { [native code] }
time: function time() { [native code] }
timeEnd: function timeEnd() { [native code] }
trace: function trace() { [native code] }
warn: function warn() { [native code] }
__proto__: Object
[ I guess there's no way to clear up the console... but I wanted someone to say it to me... ]
Update:
console.clear()
is available in all browsers
Update: As of November 6, 2012,
console.clear()
is now available in Chrome Canary.
If you type clear()
into the console it clears it.
I don't think there is a way to programmatically do it, as it could be misused. (console is cleared by some web page, end user can't access error information)
one possible workaround:
in the console type window.clear = clear
, then you'll be able to use clear in any script on your page.
這篇關于在 Google Chrome 中清除 javascript 控制臺的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!