FireBug问题:无法使用console.log [英] FireBug problem: Can't use console.log
问题描述
Firefox:3.6.13
Firebug:1.6.0和1.6.1b1 (试过)
我的Javascript不能使用console.log(或任何控制台)来输出调试消息。我不知道什么时候停止工作,但是现在我得到一个控制台没有定义,当我尝试访问它或弹出消息弹出时,我运行此代码:
if(console == undefined){
alert(1);
}
我安装了最新的FirePHP扩展(DeveloperCompanion)这是造成这个问题。没有改变任何东西。
任何想法?这是否也发生在别人身上?
$ b
[更新]
像我的问题实际上是由其他事情引起的:我使用jQuery,并把所有的代码包装在 $(function(){.....});
在页面被渲染后运行。
我没有考虑的是代码在另一个范围内运行。 console
在该范围内不可用。
要使用控制台,我必须调用 window.console.log('bla');
。
的萤火虫插件,然后重新安装它。之后检查控制台选项卡下的全部选项。在我的情况下,输出在重新安装插件后得到了回显。
I have a problem with the current version of FireBug.
Firefox: 3.6.13
Firebug: 1.6.0 and 1.6.1b1 (tried both)
My Javascript can't use console.log (or any console at all) to output debug messages. I'm not sure when it stopped working, but for now I get an "console is not defined" when I try to access it or a message popup when I run this code:
if (console == undefined) {
alert(1);
}
I had the latest FirePHP extension (DeveloperCompanion) installed but removed it to see if that was causing the problem. Didn't change anything though.
Any ideas? Is this happening to someone else, too?
[UPDATE]
Looks like my problem was actually caused by something else: I use jQuery and have all my code wrapped in $(function() {.....});
to make it run after the page has been rendered.
What I didn't consider is that then the code runs in another scope. console
is not available in that scope.
To use the console I have to call window.console.log('bla');
.
I did a disable and remove of firebug plugin and then re-installed it. After that check the "All" option under the "Console" tab. In my case the output was getting echoed there after the re-install of the plugin.
这篇关于FireBug问题:无法使用console.log的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!