So I am working on a project where I have a massive array that corresponds to the colors in a picture that the user can click on in order to select a color. I have the array in a seperate .js file and after that file loads开发者_C百科 I have an onload handler begin the rest of my script. It works in Chrome / FF but in IE it does not work unless I open the debugger. If I open the debugger it reloads the page and the array works fine. I don't have any ideas. Here is the link to my page which has the project on it its the top post on the page currently: http://sauron.hostoi.com/log/
It works in Chrome / FF but in IE it does not work unless I open the debugger. If I open the debugger it reloads the page and the array works fine.
You're using console.log()
.
When you open the Developer Tools, the console
object is defined. Until you do that, there is no console
object in Internet Explorer: Does IE9 support console.log, and is it a real function?
To fix the problem, you can either remove/comment out the console.log()
calls, or add something like this at the start of your JavaScript:
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
(snippet taken from http://html5boilerplate.com/)
精彩评论