简体   繁体   中英

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 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.

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM