开发者

How can I debug Javascript that works on my desktop but not my mobile phone?

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 w开发者_如何学Corks 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.


You can use Firebug Lite to inspect the DOM tree and debug JavaScript. Its installation is remarkably easy: Just include

<script src="https://getfirebug.com/firebug-lite.js"></script>

just below <head> (or use a bookmarklet).


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.


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
  • Adobe Shadow
  • For Mac and iPhone: iWebInspector


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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜