开发者

javascript / internet explorer 8 crazyness

开发者 https://www.devze.com 2023-03-21 05:01 出处:网络
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,

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-age开发者_如何学运维ncy.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?

  • A simple workaround: log() – A lightweight wrapper for console.log
  • More powerful version: JavaScript Debug: A simple wrapper for console.log


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号