[英]console.log(array) returns empty, but console.log(array.length) doesn't return 0
[英]console.log() is defined but doesn't log in IE - empty console
打開Developer Tools的 Internet Explorer(8和9)頁面上的Javascript到達console.log()
, 它已定義 - 但實際日志中沒有任何內容 。
事情嘗試:
alert()
雙重檢查,定義console
並且console.log
是一個函數。 console.log()
行之前和之后檢查alert()
s, if(ie){console={log:function(){}}}
,刪除指向庫的鏈接並檢查代碼片段以提及console
console.log()
s加載第三方頁面來檢查IE是否已損壞(例如http://jsbin.com記錄“init”和“runner”) window.console
console
因此,控制台處於活動狀態,但實際控制台中沒有顯示控制台消息(在“腳本”選項卡或“控制台”選項卡上)。
還有什么可以阻止console.log()
實際記錄任何內容,即使Developer Tools已打開且console.log
是已定義的函數?
在這種情況下,罪魁禍首竟然是螢火蟲 。
我的測試開發頁面通常包含這個(具有諷刺意味)幫助IE中的某些類型的調試:
<!--[if IE]>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<![endif]-->
由於它在文本編輯器中顯示為注釋,因此很容易被忽略。
警報alert(console.log);
顯示firebug lite之前和之后將console.log函數從本機代碼更改為 :
function(){return f.apply(c,arguments)}
...由於某種原因(此刻,在這里)然后什么也沒做。
沒有Firebug Lite參與, alert(console.log);
在IE中給出了這樣的:
function log() {
[native code]
}
...如果f12開發工具處於打開狀態並且如果不是,則會執行常規日志記錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.