控制台在IE9中未定义错误 [英] Console is undefined error in IE9

查看:456
本文介绍了控制台在IE9中未定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示SVG图形的图形页面。我使用Raphael图形框架。该页面在Firefox中正常显示,如果F12开发工具在IE9中设置为开,它工作正常。
如果F12开发人员模式被关闭并且应用程序在浏览器缓存被清除时启动,映射将显示IE9中的部分数据(它的节点链接图,它只显示12个节点中的一个子节点)(模拟一般用户)。

I have a graphics page which shows SVG graphics. I am using Raphael graphics framework. The page displays properly in Firefox, Also if the F12 developer tools is set 'on' in IE9 it works fine. The map show partial data (its a node link diagram and it shows only one child node out of 12 nodes) in IE9 if the F12 developer mode is set off and application is started with browser cache cleared (simulating a general user).

更新:我保持​​调试器,并显示错误控制台未定义。所以我认为它不是一个图形渲染问题,并且我没有明确使用控制台,也许mindmap js是在内部使用,但如何重新摆脱这个问题?

Update: I kept the Debugger on and Shows me the error "Console is undefined". So I think its not a graphics rendering issue, and also I am not using the console explicitly, maybe the mindmap js is using it internally, but how to again get rid of this issue?

更新
我发现了问题,并注释掉了js文件中的console.log条目。

Update: I found the issue and commented out the console.log entries from the js files.

推荐答案

可能你的代码或你调用的代码是使用 console.log 或类似的东西。

Probably your code or the code you are calling is using console.log or something like it.

您可以在全局范围中添加这个代码,为IE创建一个虚拟包装器(或任何不支持它的浏览器) 。在调用任何其他库之前,请将以下代码放在某处:

You could add this code in the global scope to create a dummy wrapper for IE (or any browser that doesn't support it). Just put the following code somewhere before you call any other libraries:

if(!(window.console && console.log)) {
  console = {
    log: function(){},
    debug: function(){},
    info: function(){},
    warn: function(){},
    error: function(){}
  };
}

这篇关于控制台在IE9中未定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆