Javascript最佳做法:处理特定于Firebug的代码 [英] Javascript best practice: handling Firebug-specific code

查看:63
本文介绍了Javascript最佳做法:处理特定于Firebug的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firebug无疑是进行JavaScript调试的绝佳工具;我广泛使用console.log().

Firebug is certainly a wonderful tool for javascript debugging; I use console.log() extensively.

我想知道是否可以将特定于Firebug的代码留在生产中. 最佳做法是什么?注释调试代码?

I wanted to know if I can leave the Firebug-specific code in production. What's the best practice? Commenting the debug code?

推荐答案

如果在生产代码中保留console.log()调用,则使用Internet Explorer访问该网站的用户将遇到JavaScript错误.如果这些人配置了额外的调试工具,则他们将看到讨厌的对话框或弹出窗口.

If you leave console.log() calls in your production code, then people visiting the site using Internet Explorer will have JavaScript errors. If those people have extra debugging tools configured, then they will see nasty dialog boxes or popups.

快速搜索发现此线程讨论了检测Firebug控制台是否存在的方法:

A quick search revealed this thread discussing methods to detect if the Firebug console exists: http://www.nabble.com/Re:-detect-firebug-existance-td19610337.html

这篇关于Javascript最佳做法:处理特定于Firebug的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆