如何调试在桌面上运行但在手机上运行不了的 Javascript?
我制作了一个使用 YUI 3 滑块 的网站。直到最近,它在各方面都运行良好。
现在,在过去的几天里,在我的移动设备(Android 手机)上,滑块的拇指不再响应触摸,并且无法拖动。
除此之外,所有 JavaScript 似乎都在正常加载和运行,因此这个问题似乎仅局限于滑块。
我发誓我没有故意对与滑块相关的代码进行任何更改,但是,我必须在 Javascript 中的某个地方做了一些操作才能导致这种差异。
问题是,在我的台式机、笔记本电脑或任何其他不涉及触摸的设备上,一切正常。因此很难确定代码哪里可能有问题。
有什么方法可以验证或测试我的代码,看看为什么它在我的移动设备上无法正常工作?
抱歉,我目前无法提供该网站,因为我还没有公开发布该网站的权限。答案必须基于一般原则。
I made a web site that uses YUI 3 sliders. It was working fine in every way up until recently.
Now, within the last few days, on my mobile device, an Android phone, the thumbs of the sliders no longer respond to touch, and can not be dragged.
Other than that, all Javascript seems to be loading and functioning properly, so this problem seems to be localized just to the sliders.
I swear I have not knowingly made any alteration to code related to the slider, but, I must have done something somewhere in my Javascript to cause this difference.
The problem is that everything works fine on my desktop or laptop or any other device where touch is not involved. So it's hard to determine where the code might be at fault.
Is there some way I can validate or test my code to see why it is not working correctly on my mobile device?
Sorry that I can not make the site available at the moment as I don't have permission to release it publicly yet. Answers will have to be based on general principle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用 Firebug Lite 检查 DOM 树并调试 JavaScript。它的安装非常简单:只需包含
在
下方(或使用小书签)。
You can use Firebug Lite to inspect the DOM tree and debug JavaScript. Its installation is remarkably easy: Just include
just below
<head>
(or use a bookmarklet).您可以使用 JSConsole 进行远程调试。该工具用于远程调试 @rem 制作的移动网络应用程序。
它很容易使用。如果您尝试,您可以找到一些教程,例如 http://jsconsole.com/remote-debugging.html。
You can use JSConsole for remote debugging. This tool is for remote debugging a mobile web app made by @rem.
It is easy to use. If you try, you can find some tutorials like http://jsconsole.com/remote-debugging.html.
也许有点晚了,但现在有几种方法可以在移动设备上调试 DOM 和 JS。使用 Adobe Shadow,您还可以检查 localStorage。
Maybe a little late, but by now there are several ways to debug the DOM and JS on mobile devices. With Adobe Shadow you're also able to inspect localStorage.
在移动设备上进行进一步调试的另一个不错的选择是 Weinre (WEb INspector REmote)
您可以使用它也作为一项服务: http://debug.phonegap.com/
Another good option for remore debugging on your mobile is Weinre (WEb INspector REmote)
You can use it as a service as well: http://debug.phonegap.com/