133

How come I get this message from Firefox Web Console

The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page

The same webpage can print messages in Chrome Console but not Firefox. I opened the same webpage in another computers' Firefox (don't know what version) Web Console can print messages. My Firefox version is the latest, 8.0.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
yeeen
  • 4,911
  • 11
  • 52
  • 73

4 Answers4

160

This happens when the page itself defines a global variable called console, for example. If the page is browser-sniffing to decide whether to define it, the behavior could differ in different browsers.

In the case of Firefox it also happens when Firebug is installed and its console is enabled, since that overrides the default window.console.

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
  • 75
    @yeeen Do you have Firebug installed? It also overrides `window.console` with its own console... – Boris Zbarsky Nov 22 '11 at 03:47
  • 1
    yes i hv Firebug. So how do i use the Firebug's console or what should i do? But how come the other machine tt has Firefox with Firebug installed has no problem? – yeeen Nov 22 '11 at 12:34
  • 5
    @yeeen You could open Firebug and use its console, yes. Or you could disable Firebug if you don't want it hijacking the console. As for the other machine.... does it have the Console panel enabled in Firebug? – Boris Zbarsky Nov 22 '11 at 13:48
  • i see... the other machine don't hv console panel enabled, my machine has... no wonder – yeeen Nov 24 '11 at 01:36
  • 4
    @BorisZbarsky the Firebug clause is almost an answer in itself. Could you include it in the answer proper? – Barney Mar 24 '14 at 09:55
30

I had the same exact error message, and once I removed firebug, it went away.

I'm not saying you should remove firebug, I love firebug, but that is most probably the source of the error for you as well. One more note, the error was still there even if firebug was turned off (disabled) for that particular page.

Costa Michailidis
  • 7,691
  • 15
  • 72
  • 124
  • 8
    It seems enough to pull down the context menu from the "Console" tab of Firebug, deselect the "Enabled" checkbox and reload the page. – Jonas Berlin Mar 05 '14 at 05:39
  • @Mike I've actually been increasingly impressed with FF developer tools. And I can't wait to check out WebIDE and App Manager. Got my dev set coming in today for Firefox OS. – Costa Michailidis Jul 16 '14 at 14:52
  • 1
    Along with disabling firebug make sure that you hit "Clear Activation List" from the firebug option drop down. This clears out all the firebug codes form your page. Now Use ctrl+shift+k to bring up Firefox console that displays your console logs. – Clain Dsilva Jul 20 '14 at 06:27
2

Here is a JavaScript workaround I used to restore console API after it was set to empty function by a script on the page (works in Firefox 46, tested in Firebug and in greasemonkey script):

function restoreConsole() {
    var i = document.createElement('iframe');
    i.style.display = 'none';
    document.body.appendChild(i);
    window.console = i.contentWindow.console;
    i.parentNode.removeChild(i);
}

More info and credentials: Restoring console.log()

Community
  • 1
  • 1
dominik
  • 2,404
  • 2
  • 29
  • 33
1

Right click over firebug console tab and uncheck "enabled" option (the first one).