What happened to console.log in IE8?

后端 未结 17 2953
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 04:45

According to this post it was in the beta, but it\'s not in the release?

17条回答
  •  独厮守ぢ
    2020-11-22 05:30

    Here is a version that will log to the console when the developer tools are open and not when they are closed.

    (function(window) {
    
       var console = {};
       console.log = function() {
          if (window.console && (typeof window.console.log === 'function' || typeof window.console.log === 'object')) {
             window.console.log.apply(window, arguments);
          }
       }
    
       // Rest of your application here
    
    })(window)
    

提交回复
热议问题