Internet Explorer and console.log

Possible Duplicate:
Common idiom to avoid IE throw: Error: 'console' is undefined
'console' is undefined error for internet explorer

Is there a reliable way I can guard against "console.log" causing a bug in IE?

While I find console.log extremely useful, it is always a source of grief with Internet Explorer.

If it's just statements that I have left in my code, that's fine, I could deal with that. But sometimes I find that there are "console.log" calls in JavaScript libraries I am using - which cause IE to crash or, on IE8/9, will only work while the Dev tools console window (F12) is open.

What I am looking for is either:

  • a library that emulates console.log on IE6/7/8/9 so it doesn't crash everything when something tries console.log()
  • a way to guard against this error.
  • 链接地址: http://www.djcxy.com/p/41976.html

    上一篇: 浏览器测试:一台机器上的所有主流浏览器

    下一篇: Internet Explorer和console.log