Restoring console.log()
Since original console is in window.console object, try restoring window.console
from iframe
:
var i = document.createElement('iframe');i.style.display = 'none';document.body.appendChild(i);window.console = i.contentWindow.console;// with Chrome 60+ don't remove the child node// i.parentNode.removeChild(i);
Works for me on Chrome 14.
For example,
delete console.log
would also restore console.log
:
console.log = null;console.log; // nulldelete console.log;console.log; // function log() { [native code] }
Magento has the following code in /js/varien/js.js
- comment it out & it will work.
if (!("console" in window) || !("firebug" in console)){ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}}