Created
May 25, 2011 23:29
-
-
Save astorm/992233 to your computer and use it in GitHub Desktop.
Fix console.log in Chrome and Magento
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add to the package layout (via local.xml or however you prefer) --> | |
<!-- Also, best to remove before deployment, as some users report --> | |
<!-- it makes IE 7 crash --> | |
<default> | |
<reference name="content"> | |
<block type="core/text" name="fix.console" as="fix.console"> | |
<action method="setText"> | |
<text><![CDATA[<script type="text/javascript"> | |
iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
document.getElementsByTagName('body')[0].appendChild(iframe); | |
window.console = iframe.contentWindow.console; | |
console.firebug = "faketrue"; | |
</script>]]></text> | |
</action> | |
</block> | |
</reference> | |
</default> |
Thanks for the heads up, but I'm not sure I follow. If you're wrapping everything in an if(console), how does the code run in IE 7?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thx, great snippet! but you need to comment it out after development. besides those errors in IE8 @guymoller mentioned, ie7 crashes completely. if (console) does not fix that.