JQuery script only works with ie8 / 9 developer tools

I am trying to debug my jQuery (Tools) script, which does not work in IE. An example can be found here:

http://dl.dropbox.com/u/16799097/www/demo/jQuery_Slider/index.html

It loads correctly, the first (sliding) event occurs, and then nothing is added.

When I try to debug my script by reloading the page with the developer tools (press F12), everything works like a charm ... What if I can not debug?

Any help would be appreciated, I'm stuck ...

+8
jquery ie-developer-tools
source share
1 answer

Error (in slider.js ):

 'console' is undefined 

The console object is only defined in IE when you open the Developer Tools . Then there is no longer a JavaScript error, and everything works.

To fix the problem, you can either remove / comment on the console.log call, or add something like this as your very first JavaScript block:

 // 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/ )

+12
source share

All Articles