Firefox Web Console Disabled?

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.


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

链接地址: http://www.djcxy.com/p/41974.html

上一篇: Internet Explorer和console.log

下一篇: Firefox Web控制台已禁用?