亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

使用JavaScript檢測(cè)Firefox瀏覽器是否啟用了Firebug的代碼

 更新時(shí)間:2010年12月28日 19:13:14   作者:  
在啟用Firebug的情況下訪問GMail會(huì)收到一個(gè) Firebug會(huì)讓Gmail變慢 的警告,這是如何檢測(cè)的呢?這里就說說。
在啟用了firebug面板后,會(huì)增加一個(gè)window.console對(duì)象及window.console.firebug變量用于保存當(dāng)前firebug的當(dāng)前版本,當(dāng)關(guān)閉firebug面板后則變回正常,于是我們可以通過判斷其是否存在來檢測(cè)是否開啟了firebug。
復(fù)制代碼 代碼如下:

Boolean(window.console && window.console.firebug)

于是,為了方便在沒有啟用firebug的情況下避免腳本錯(cuò)誤,可以在腳本最前面加入以下語(yǔ)句手工創(chuàng)建空的console對(duì)象以作兼容。
復(fù)制代碼 代碼如下:

if (!window.console) {
// ignore firebug console call if it's not installed
// for firebug 1.6.0
(function(m, i) {
window.console = {};
while (i--) {
window.console[m[i]] = function() {};
}
})('log debug info warn exception assert dir dirxml trace group groupEnd groupCollapsed time timeEnd profile profileEnd count clear table error notifyFirebug'.split(' '), 22);
}

這樣,在IE下能正常預(yù)覽頁(yè)面,在Firefox、Chrome、Safari中也能正常輸出調(diào)試信息。

相關(guān)文章

最新評(píng)論