IE9:脚本只能在调试器,而不是在不进行调试 [英] IE9: Script only works in debugger, but not when NOT debugging

查看:218
本文介绍了IE9:脚本只能在调试器,而不是在不进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些麻烦与Internet Explorer的兼容性。我在建设有HTML5画布,CSS3和JavaScript的大量使用的在线工具。该项目工程在所有主要浏览器很好,除了IE浏览器。

IE9切换到兼容模式,所以我设置


 < META HTTP-EQUIV =X-UA-Compatible的内容=IE = 9/>


迫使IE浏览器处理与IE9标准页。 IE浏览器不再陷入兼容模式,但该脚本确实还不能正常工作。一些基本的功能绘制或拖动对象的作品,但只有半壁江山。

这是什么在这种情况下,一个程序员做的:他开始调试。而这也正是魔术发生。当我启动IE9开发者工具(IE9浏览器和文档模式也一样),脚本工作正常。但是,我应该怎么调试脚本调试条件下正常工作,并且有错误时没有调试。

目前,我不知道该怎么做。也许有人可以给我一个提示?非常感谢!


解决方案

IE9不喜欢控制台通话,而无须证明我们的任何code,我们只能猜测的问题是什么。您可以删除任何的console.log 消息或之前的任何code。使用这个片段被称为:

 控制台= {日志:功能(){}}(window.console!);

I have some trouble with Internet Explorer's compatibility. I'm building an online tool with massive usage of HTML5 canvas, CSS3 and JavaScript. The program works fine in all major browsers, except for Internet Explorer.

IE9 switched into compatibility mode, so I set

<meta http-equiv="x-ua-compatible" content="IE=9"/>

to force IE to process the page with IE9 standards. IE does no longer fall into compatibility mode, but the script does still not work properly. Some basic functionality as drawing or dragging objects works, but only "half".

What does a programmer do in this case: He starts the debugger. And that's where the magic happens. As soon as I start the IE9 developer tools (with IE9 browser and document mode as well), the script works properly. But how should I debug a script which works fine under debugging conditions, and has errors when not debugging.

Currently, I have no clue what to do. Maybe someone can give me a hint? Thanks a lot!

解决方案

IE9 doesn't like console calls, and without showing us any code we can only guess what the issue is. You can either remove any console.log messages or use this snippet before any code is called:

(!window.console) console = {log: function() {}};

这篇关于IE9:脚本只能在调试器,而不是在不进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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