This gist creates a simpel Console polyfill piece of code to add to projects where IE8 will visit your site.
It will create a simple console object on window
object avoiding any forgotten console.log
for instance.
It should be run on a browser which supports console object, say in the developer toolbar. It wil then generate a line of javascript code for you to paste into the website.
Last active
August 29, 2015 13:56
-
-
Save netsi1964/8864733 to your computer and use it in GitHub Desktop.
Generate window.console polyfill
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
if (typeof window.console==='undefined') window.console = {'ver':'Fri Feb 07 2014 16:44:36 GMT+0100 (CET)','debug':function(){},'error':function(){},'info':function(){},'log':function(){},'warn':function(){},'dir':function(){},'dirxml':function(){},'table':function(){},'trace':function(){},'assert':function(){},'count':function(){},'markTimeline':function(){},'profile':function(){},'profileEnd':function(){},'time':function(){},'timeEnd':function(){},'timeStamp':function(){},'timeline':function(){},'timelineEnd':function(){},'group':function(){},'groupCollapsed':function(){},'groupEnd':function(){},'clear':function(){}} |
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
var s = "if (typeof window.console==='undefined') window.console = {'ver':'"+new Date().toString()+"'"; | |
for(a in console) { | |
var v=console[a]; | |
if (typeof v==="function") { | |
s+=",'"+a+"':function(){}"; | |
} | |
}; | |
s+="}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment