Restoring console.log()
For example,
delete console.log
would also restore console.log
:
console.log = null;
console.log; // null
delete console.log;
console.log; // function log() { [native code] }
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.