A related solution is basically an option (with several additional features):
EDIT The code below does not work if firefox is present. This will teach to place code without checking just to show my not-so-operator 1337 || skillz:
window.console = window.console || {}; console.log = function(){};
The reason for this is that the firefox console is actually the recipient of only the off window property . Therefore, we cannot install it. Instead, use something like this:
if (!window.console) { window.console = {}; window.console.log = function(){}; }
Also, console.log (and console.warn , console.error ) will work in Webkit browsers, including mobile Safari, pretty cool, huh?
Igor Zevaka
source share