firebug_如何嗅探和禁用Firebug

firebug

If you're a hardcore Web Developer like me, you're probably well aware of the excellent Firefox plugin known as Firebug. Firebug's built in tools for monitoring and debugging CSS, HTML, and JavaScript/AJAX can improve development time efficiency exponentially.

如果您是像我这样的顽固的Web开发人员,那么您可能非常了解出色的Firefox插件Firebug 。 Firebug内置的用于监视和调试CSS,HTML和JavaScript / AJAX的工具可以成倍地提高开发时间效率。

As great as Firebug is, using Firebug does have its disadvantages while browsing websites that perform numerous AJAX requests. Firebug chokes on trying to analyze and display all of the information that it can make Firefox hang up. This, of course, is followed by [CONTROL] + [ALT] + [DELETE] and a restart of Firefox. Two such websites that warn users about this problem are Gmail and NetVibes.

就像Firebug一样,在浏览执行大量AJAX请求的网站时,使用Firebug确实有其缺点。 Firebug试图分析和显示可能使Firefox挂断的所有信息而感到窒息。 当然,接着是[CONTROL] + [ALT] + [DELETE],然后重新启动Firefox。 警告用户此问题的两个此类网站是Gmail和NetV​​ibes。

If you fear that a website you are developing could cause problems for visitors with Firebug enabled, you have a few options for preventing problems.

如果您担心正在开发的网站可能会对启用Firebug的访问者造成问题,那么您可以使用几种方法来预防问题。

嗅探萤火虫并显示消息 (Sniffing Firebug and Displaying A Message)

The following JavaScript sniffs for Firebug. You could use this to display a "Please disable Firebug..." type of message.

以下JavaScript嗅探Firebug。 您可以使用它来显示“请禁用Firebug ...”类型的消息。

if (window.console && window.console.firebug) {
	/* firebug found! */
}

禁用Firebug功能 (Disable Firebug Functionality)

The following JavaScript code doesn't disable Firebug but renders some problem functionality useless. The following snippet of code was taken from Yahoo! Media Player.

以下JavaScript代码不会禁用Firebug,但会使某些问题功能变得无用。 以下代码段来自Yahoo! 媒体播放器。

if (! ('console' in window) || !('firebug' in console)) {
    var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
    window.console = {};
    for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}

翻译自: https://davidwalsh.name/how-to-sniff-firebug-disable

firebug

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值