【问题标题】:Firebug console: not showing console.logFirebug 控制台:不显示 console.log
【发布时间】:2014-04-26 02:39:28
【问题描述】:

我正在尝试测试某些东西,出于某种原因,在 Firebug 控制台中工作时,我无法使用 getElementByTagName('script') 方法在 HTML 页面上创建脚本标签数组。我意识到我可能忽略了一些愚蠢的事情。

这是虚拟的 HTML 页面:

<html>
<head>
    <title>Random Crapolla Page</title>
    <h1>Random Crapolla Page</h1>
</head>

<body>
    <div id="whyNot">
    <p id="p1">
        <a href="http://google.com">Here is link one</a><br />
        <a href="http://google.com">Oh poop here's another</a><br />
        <a href="http://google.com">And a 3rd for good measure</a><br />
    </p>

    <a id="p2">
        Latin. Latin. Latin...<br />
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
    </p>
    </div>
    <!-- Script tag testing-->
    <script type="text/javascript" src="itDoesntExist.js"></script>
    <script type="text/javascript" src="dummyJSnumeroDos.js"></script>
</body>

这就是我在 Firebug 控制台中输入的内容:

var scripts = document.getElementsByTagName('script');
console.log(scripts);


在控制台中全部选中

【问题讨论】:

  • 在你的问题的顶部,你有getElementByTagName('scripts') (复数脚本),在底部你正确地有getElementByTagName('script')。您实际使用的是哪个?
  • @cookiemonster 我的输出什么都没有。我正在使用“脚本”。
  • 应该是document.getElementsByTagName('script');,注意Elements中的复数形式,script为单数形式。它应该工作。另一种可能是document.querySelectorAll('script')
  • 我会提前为这个问题道歉,但您点击的是Run 按钮,对吧? (对不起。)
  • 截至 2016 年底。年 firebug 不再维护或开发,正如其网页上所说的 getfirebug.com

标签: javascript html firebug console.log


【解决方案1】:

您选择了 info,它只会显示信息。点击全部按钮!

为了表明它有所作为,新的截图

【讨论】:

  • 最后一张 OP 发布的图片显示全部启用。但无论哪种方式,info 都会显示console.log() 输出,不是吗?我有一段时间没有使用 Firebug。
  • 啊,console.info()。说得通。 +1
  • @cookiemonster 添加了一个新的屏幕截图,向您展示它的重要性。
  • 请看其他答案。仍在使用 Firebug,确实错过了它已停产...
  • 这应该不是正确的答案,新版本的 Firefox 已经集成了开发工具,比如 Chrome。
【解决方案2】:

按 CTRL-SHIFT-K 打开完整的控制台。从顶部开始的第二行有选项卡——NET、CSS、JS ... 日志记录。点击日志旁边的下拉菜单并确保至少“日志”处于打开状态。

您的消息现在应该可见。用这个代替 CTRL+SHIFT+J

【讨论】:

    【解决方案3】:

    Firebug 现在是officially discontinued,由于 Firebug 用于访问相关数据的 Firefox 内部 API 发生了变化,因此 Firefox 51.0.1 中的控制台输出中断。供参考,这是错误:

    TypeError: ConsoleAPIListener 不是构造函数 console.js:149:38

    建议 Firebug 用户改用Firefox DevTools。在那里,控制台输出按预期工作。

    【讨论】:

    • 其实,如果你有足够当前的版本,你可以右键查看是否有“Inspect Element (Q)”选项。如果是这样,您就有了具有新功能的版本,包括控制台输出。
    • 请注意,“检查元素 (Q)”选项会打开 Firefox DevTools。这个选项已经存在好几年了。
    【解决方案4】:

    抱歉,我是Firebug 的忠实粉丝,我不喜欢Firefox dev tools 工具(检查元素)。

    我将 Firefox 降级到版本 50.1.0,我看到了 console.log 消息。 https://ftp.mozilla.org/pub/firefox/releases/50.1.0/

    希望对其他粉丝有所帮助...

    【讨论】:

    • 我在another answer on Stack Overflow 中列出了更多替代方案。降级应该只是一个临时解决方案,因为您缺少重要的安全更新和其他改进。顺便提一句。 Firebug 可以正常工作的最后一个 Firefox 版本应该是 48.0。
    猜你喜欢
    • 2011-10-26
    • 1970-01-01
    • 1970-01-01
    • 2013-05-28
    • 2015-12-26
    • 1970-01-01
    • 2011-10-26
    • 2012-10-17
    • 2013-09-16
    相关资源
    最近更新 更多