码迷,mamicode.com
首页 > 其他好文 > 详细

ie9下出现bug,打开f12bug就消失问题解决

时间:2017-05-02 16:46:01      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:题解   log   blank   asp   file   ons   ie8   lan   cep   

今天遇到一个问题,ie9下页面出现bug,代码不往下执行,打开f12调试,bug就消失了。找了很久找到原因:

IE8/IE9要先按F12才有console对象

参考来源: http://msdn.microsoft.com/zh-cn/library/ie/gg589530%28v=vs.85%29.aspx

在代码中重新定义console对象,加上如下代码:


window.console = window.console || (function(){ 
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(){}; 
return c; 
})(); 

 

问题解决。

 

以上文章抄自于 http://blog.csdn.net/koala25/article/details/70230046, 亲测可行。因为我也遇到了同样的问题,困扰了很久。

ie9下出现bug,打开f12bug就消失问题解决

标签:题解   log   blank   asp   file   ons   ie8   lan   cep   

原文地址:http://www.cnblogs.com/Jerry1985/p/6796733.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!