admin管理员组

文章数量:1135071

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.

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.

Share Improve this question edited Nov 21, 2011 at 13:19 Rory McCrossan 337k41 gold badges319 silver badges350 bronze badges asked Nov 21, 2011 at 13:12 yeeenyeeen 4,94512 gold badges53 silver badges74 bronze badges 2
  • 2 search your code for firebug and console and make sure they aren't set to null, undefined or false – Seth Commented Nov 21, 2011 at 13:19
  • 1 maybe noscript plugin is doing that ! just check – unloco Commented Nov 21, 2011 at 13:27
Add a comment  | 

4 Answers 4

Reset to default 159

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.

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.

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

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

本文标签: javascriptFirefox Web Console DisabledStack Overflow