Object 'unavailable' in Firefox console
Asked Answered
S

2

16

I have a few divs with class='class_name', and also have declared

var A = document.getElementsByClassName('class_name');
console.log(A[0]);

The Chrome console shows:

<div class="class_name"> div 1 </div>

The Firefox console shows:

<unavailable>

What's the issue or what otherwise is the possible cause?

Sworn answered 28/7, 2017 at 12:15 Comment(6)
add firefox version. and a snippet tooPlatoon
Had similar issue once with Firefox + Firebug. Turns out Firebug is not being maintened anymore, had to switch to the Firefox Developer Edition to get a working console again.Pilloff
@Sagar V7 - Firefox version is 52.0.2 (32-bit) - Please explain what you mean by 'snippet' ? Working example in Fiddle or some like that?Sworn
@Pilloff -Thnx 4 suggestion - Strange thing is that many other logs in console.log are showing just fineSworn
@Sworn Same for me, just saying you might want to give it a try. Might also just be another problem of course.Pilloff
I have tried it in Chrome and Firefox (48 & 54) - everything is ok. I used the browser's console in both cases.Nomo
B
8

There are currently four solutions :

  1. Use console.log(JSON.stringify(variable, null, 4)) in place of console.info(variable). This has the additional advantage of catching errors caused by any type of memory management bugs, but it may cause a cyclic redundancy on actual elements when interpolating parent/child elements. Original solution by me.

  2. Use Firefox Web Console (control+shift+K, or Tools->Web Developer->Web Console) instead of the standard Firefox Browser Console (control+shift+J, or Tools->Web Developer->Browser Console). Thanks to Panos Astithas for providing this info!

  3. Disable e10s in FF config. Goto about:config as an address within Firefox, and set browser.tabs.remote.autostart or loop.remote.autostart to false. Thanks to Janekptacijarabaci for providing this info!

  4. Revert your FireFox Quantum version. I uninstalled Firefox 57 and 59 ("Firefox Quantum") and then installed Firefox version 56.0.2. This fixed the problem for me. Get it here: https://ftp.mozilla.org/pub/firefox/releases/56.0.2/ Original solution by me.

Firefox Development Ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=1136995

UPDATE : Problem persists with Firefox v. 59.0.2, and v. 59.0.3.

Blim answered 22/1, 2018 at 17:28 Comment(2)
OP was not using Firefox 57 to begin with, so changing 4 versions is a wide guess.Cellobiose
@TylerH: I noted that, but thank you, anyway. =) Either way, have you tried my solution, or did you have the problem?Blim
V
7

Two possible workarounds:

1) Use the "Web-Console".
The "Web-Console" (CtrlShiftK instead of the "Browser-Console" CtrlShiftJ) shows the expected output.

2) Disable "e10s" multiprocessor support:

- about:config
- browser.tabs.remote.autostart = False

The Browser-Console will show the expected output if e10s is disabled.

Recap (02.01.2018):

The problem still persists in FF 64.0:
in general, objects will be shown as "unavailable" in the Browser-Console.

To reproduce (e10s enabled):

<html><head>
    <script type="text/javascript">
        console.log( 'test' );
        console.log( 123 );
        console.log( [ 1, 2, 3 ] );
        console.log( { x: 'x' } );
        console.log( document.getElementById('myDiv') );
        window.onload = function() {
            console.log( document.getElementById('myDiv') );
        };
    </script>
</head><body>
    <div id="myDiv"></div>
</body></html>

Output in Browser-Console (wrong output):

test
123
<unavailable>
<unavailable>
null
<unavailable>

Output in Web-Console (as expected):

test
123
Array(3) [ 1, 2, 3 ]
Object { x: "x" }
null
<div id="myDiv">

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1136995

Vitriol answered 2/1, 2019 at 14:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.