jQuery script only working under ie8/9 developer tools

杀马特。学长 韩版系。学妹 提交于 2019-11-30 09:14:43
thirtydot

The error is (in slider.js):

'console' is undefined

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

To fix the problem, you can either remove/comment out the console.log call, or add something like this as your very first block of 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/)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!