jQuery脚本仅在ie8/9开发人员工具下工作 [英] jQuery script only working under ie8/9 developer tools

查看:94
本文介绍了jQuery脚本仅在ie8/9开发人员工具下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试在IE上不起作用的jQuery(Tools)脚本.可以在此处找到示例:

I am trying to debug my jQuery(Tools) script that is not working on 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 append.

当我尝试通过使用开发人员工具重新加载页面(按F12键)来调试脚本时,一切都像一个超级按钮……如果无法调试,该怎么办?

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

任何帮助将不胜感激,我被困住了...

Any help would be appreciated, I am stuck ...

推荐答案

错误是(在slider.js中):

'console' is undefined

console对象

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.

要解决此问题,您可以删除/注释console.log调用,或在第一个JavaScript块中添加如下内容:

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||{});

(摘录自 http://html5boilerplate.com/的片段)

这篇关于jQuery脚本仅在ie8/9开发人员工具下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆