简体   繁体   English

javascript / Internet Explorer 8 疯狂

[英]javascript / internet explorer 8 crazyness

I have a web page with javascript in it, everywhere it runs fine except ie8.我有一个 web 页面,其中包含 javascript,除了 ie8 之外,它在所有地方都运行良好。 When I load on IE8 my javascript is missing, so I turn on the developer tools and javascript console to debug it, refresh, and my javascript loads.当我在 IE8 上加载时,我的 javascript 丢失了,所以我打开开发人员工具和 javascript 控制台来调试它,刷新,然后我的 javascript 加载。 It seems it only loads when I have previously enabled the JavaScript console.它似乎只在我之前启用了 JavaScript 控制台时才加载。

Can anybody shed some light on this?任何人都可以对此有所了解吗? You can view the page here你可以在这里查看页面

http://www.orchestra-agency.com/contentviewer_beta.php?cv=ORC_TWL_01&p=0 http://www.orchestra-agency.com/contentviewer_beta.php?cv=ORC_TWL_01&p=0

Does the page make any console calls, like console.log('foo') , without first making sure that console and console.log are defined?该页面是否在没有首先确保定义了consoleconsole.log的情况下进行任何console调用,例如console.log('foo')

Try loading this on the page header尝试在页面 header 上加载此内容

<script type="text/javascript">
// IE fix
if(!window.console) {
    var console = {
        log : function(){},
        warn : function(){},
        error : function(){},
        time : function(){},
        timeEnd : function(){}
    }
}
</script>

It removes the functionality of any console code you have.它删除了您拥有的任何控制台代码的功能。 If it fixes the problem, you have to find and clean all of them from your code...如果它解决了问题,您必须从您的代码中找到并清除所有这些问题......

This happens when the browser tries to output to the console but it doesn't exist so it throws an exception and blocks all further javascript.... :S当浏览器尝试 output 到控制台但它不存在时会发生这种情况,因此它会引发异常并阻止所有进一步的 javascript ....:S

Does it work in FF without Firebug enabled?它在没有启用 Firebug 的情况下在 FF 中工作吗? If not, I'd bet it's the console.log's that cause it.如果不是,我敢打赌是console.log 造成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM