console.log()的兼容性

在别人那里看到的,兼容IE8-的console.log的实现,以前没想过。

if(typeof console == "undefinde"){

  this.console = {log: function(msg){alert(msg);}}

}

这种方法在IE8-未开启调试模式的时候同样可以输出信息。

不过IE8中开启调试模式是可以在控制台输出console.log信息的,所以这种方法的必要性有待验证。

posted @ 2013-10-23 09:10  charling  阅读(511)  评论(0编辑  收藏  举报