欢迎光临
我们一直在努力

ie下不兼容console.log()的解决办法

浏览器console兼容性JS

// Console-polyfill. MIT license.
// https://github.com/paulmillr/console-polyfill
// Make it safe to do console.log() always.
(function(global) {
    'use strict';
    global.console = global.console || {};
    var con = global.console;
    var prop, method;
    var empty = {};
    var dummy = function() {};
    var properties = 'memory'.split(',');
    var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +
    'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +
    'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');
    while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;
    while (method = methods.pop()) if (typeof con[method] !== 'function') con[method] = dummy;
    // Using `this` for web workers & supports Browserify / Webpack.
})(typeof window === 'undefined' ? this : window);

 

赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » ie下不兼容console.log()的解决办法

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址