22

I am trying to test something, and for one reason or another, while working in the Firebug console, I am unable to create an array of script tags on the HTML page using the getElementByTagName('script') method. I realize there is probably something stupid I am overlooking.

This is the dummy HTML page:

<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>

And this is what I'm typing into the Firebug console:

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

enter image description here


All selected in Console enter image description here

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
beckah
  • 1,543
  • 6
  • 28
  • 61
  • 1
    At the top of your question, you have `getElementByTagName('scripts')` *(plural scripts)*, and at the bottom you correctly have `getElementByTagName('script')`. Which are you actually using? – cookie monster Mar 19 '14 at 16:57
  • @cookiemonster my output is nothing. And i am using 'script'. – beckah Mar 19 '14 at 17:01
  • 1
    It should be `document.getElementsByTagName('script');`, note the plural in Elements, and script as singular. It should work. An alternative might be `document.querySelectorAll('script')` – mati Mar 19 '14 at 17:01
  • @Matias - it is singular 'script' :/ both methods created no output – beckah Mar 19 '14 at 17:03
  • As long as the code is exactly as you show at the bottom, you should get at least *something* for the output. You're saying that absolutely nothing shows up in the console? – cookie monster Mar 19 '14 at 17:04
  • @cookiemonster No such luck :/ included a picture of what i'm doing – beckah Mar 19 '14 at 17:06
  • 1
    I'll apologize in advance for this question, but you're clicking the `Run` button, right? *(Sorry.)* – cookie monster Mar 19 '14 at 17:06
  • @cookiemonster yeah. i also noticed i didn't put the ending ";", but that did not help either – beckah Mar 19 '14 at 17:07
  • Console and All mode? – progysm Mar 19 '14 at 17:10
  • @progysm yeah. just put a picture in the question of how i'm selecting all – beckah Mar 19 '14 at 17:18
  • 8
    **As of end of 2016. year firebug is no longer maintained or developed** as it says on their web-page https://getfirebug.com – Edgars Aivars Jan 30 '17 at 20:07

4 Answers4

54

Firebug is officially discontinued now and the console output is broken in Firefox 51.0.1 due to a change in the Firefox internal APIs Firebug uses to access the related data. For reference, this is the error:

TypeError: ConsoleAPIListener is not a constructor console.js:149:38

Firebug users are advised to switch over to the Firefox DevTools instead. There, the console output works as expected.

Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
  • 1
    Actually, if you have a current enough version, you can right click and see whether you have an "Inspect Element (Q)" option. If so, you have a version with the new feature, including the console output. – Alexis Wilke Mar 20 '17 at 05:42
  • Note that the "Inspect Element (Q)" option opens the Firefox DevTools. And that option already exists for several years now. – Sebastian Zartner Mar 20 '17 at 12:57
15

You have info selected, it will only show info. Click the All button!

enter image description here

And to show that it makes a difference, new screenshots

enter image description here

epascarello
  • 204,599
  • 20
  • 195
  • 236
13

Press CTRL-SHIFT-K to open full console. In the second row from the top there are tabs- NET, CSS, JS ... Logging. click on the dropdown next to logging and make sure that at least "log" is on.

Your messages should be visible now. Use this instead of CTRL+SHIFT+J

Stoyan Dimov
  • 5,250
  • 2
  • 28
  • 44
Ananttah
  • 337
  • 3
  • 6
4

Sorry, but I'm a huge fan of Firebug, and I don't like the Firefox dev tools tool (inspect element).

I downgraded Firefox to version 50.1.0, and I see the console.log msgs back. https://ftp.mozilla.org/pub/firefox/releases/50.1.0/

Hope that helps other fans ...

Ricky Levi
  • 7,298
  • 1
  • 57
  • 65
  • 1
    I've outlined more alternatives in [another answer on Stack Overflow](https://stackoverflow.com/a/41890636/432681). Downgrading should just be a temporary solution, as you're missing important security updates and other improvements. Btw. the last version of Firefox where everything of Firebug works should be 48.0. – Sebastian Zartner Jun 23 '17 at 11:49