For some reason, the prototype framework (or another JavaScript code) that is shipped with Magento is replacing standard console functions, so I can't debug anything. Writing down in JavaScript console console
I get the following output:
> console Object assert: function () {} count: function () {} debug: function () {} dir: function () {} dirxml: function () {} error: function () {} group: function () {} groupEnd: function () {} info: function () {} log: function () {} profile: function () {} profileEnd: function () {} time: function () {} timeEnd: function () {} trace: function () {} warn: function () {}
I'm using Google Chrome version 13.0.782.112
on Linux.
Prototype JavaScript framework, version 1.6.0.3
Is there a quick way to solve this?
The console. log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user.
Console Logs in Chrome: In Google Chrome, the Console Logs are available as a part of Chrome Dev Tools. To open the dedicated Console panel, either: Press Ctrl + Shift + J (Windows / Linux) or Cmd + Opt + J (Mac).
The console. log() is a function that writes a message to log on the debugging console, such as Webkit or Firebug. In a browser you will not see anything on the screen. It logs a message to a debugging console.
Generally yes, its not a great idea to expose log messages in your production code. Ideally, you should remove such log messages with a build script before deployment; but many (most) people do not use a build process (including me).
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; // null delete console.log; console.log; // function log() { [native code] }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With