Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 784
Questioner Avatar asked Aug 26 '11 07:08

Questioner


People also ask

Can Visual Studio debug JavaScript?

You can debug JavaScript and TypeScript code using Visual Studio. You can hit breakpoints, attach the debugger, inspect variables, view the call stack, and use other debugging features.

How do I debug a .JS file?

We can open the console by pressing the F12 key or by clicking the right button and then selecting inspect. Javascript provides the keyword Debugger to debug the code.


2 Answers

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

like image 100
phihag Avatar answered Sep 21 '22 18:09

phihag


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.

like image 26
Sanghyun Lee Avatar answered Sep 22 '22 18:09

Sanghyun Lee