简体   繁体   中英

javascript / internet explorer 8 crazyness

I have a web page with javascript in it, everywhere it runs fine except 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. It seems it only loads when I have previously enabled the JavaScript console.

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

Does the page make any console calls, like console.log('foo') , without first making sure that console and console.log are defined?

Try loading this on the page 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

Does it work in FF without Firebug enabled? If not, I'd bet it's the console.log's that cause it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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