How to debug phonegap javascript application on visual studio 2012 emulator - javascript

I am trying to run my application on windows 8 phone visual studio emulator but seems like some error in my code. But i am not able to debug the java script code.
Is there any way to debug the code through emulator?
Thanks in advance

You can use JSConsole or weinre (which is BTW also a part of Cordova). You inject a line of code into your JavaScript, which connects to a console on another computer.
Actually, seems someone already made it easy: http://debug.phonegap.com/ (using weinre)

Related

Windows 10 / JS : I am stuck with debugging "HelloWorld" app

I have some experience on HTML5 & JS but really a novice with Windows 10 UWP. At first, I tried to implement simple HelloWorld with HTML5/JS/Win 10/Visual Studio following the instructions of:
https://msdn.microsoft.com/en-us/library/windows/apps/mt280216.aspx
I got the application working without problems but when I tried to study the control flow of the app, I faced some problems:
console.log("text") does not seem to output anything into Visual Studio JavaScript console window. How should I do logging in Windows 10 / Visual studio?
when running my HelloWorld in Visual Studio "localMachine", breakpoints are not working; only when I am running HelloWorld in Visual Studio Emulator, the breakpoints work. What I am doing wrong?
Visual studio is quite complex piece of a tool, so probably I am missing some settings somewhere, so could somebody explain what I am doing wrong

Javascript debugger similar to Visual Studios debugger?

Is there any debugger like there is in Visual Studio,for example in C#, I can follow every step of the program and find out how the code works, which function does it call first or what value does a certain integer has after loop? Thanks
Yes, there is. It's in Visual Studio!
When you launch a your web application from Visual Studio in Internet Explorer you can set breakpoints in your JavaScript code and use the debugger from Visual Studio just as you would with C#.
Make sure that you have debugging scripts enabled in Internet Explorer.
You can find more info here in the documentation Client-Side Script Debugging at MSDN.

Trouble with iOS and PhoneGap

Just started trying to adapt my html, css, javascript files to iOS using PhoneGap (I've also tried NimbleKit but the result is the same). I have a web app that I originally wrote for the Blackberry Playbook. The app works fine on the Playbook and in Chrome and Safari. However, when I try and run it through XCode with PhoneGap, the app displays on the simulator but does not seem to properly run the database coding (at least I think that is the problem). I do not get any build errors.
From the documentation, NimbleKit seems to just support its own internal SQLite, but PhoneGap seems to support WebDB, which is what my database is written in.
Finally, the simulator doesn't seem to run some global variables I have (I know, I know, don't use global variables) although that could be because they appear just after my DB initialization at the beginning of my javascript file.
Any thoughts or points in the right direction would be very helpful. Even if it is to some documentation which can help me debug the app in the iOS sim.
Thanks in advance.
Cold your problem be related to this?
http://phonegap.com/2012/04/18/ios-5-1-and-the-embedded-uiwebview-with-cordova/
I was facing a similar problem with PhoneGap and iOS Simulator last week,
all the code i wrote seem to have no problem,
anyway i tried this remote web inspector, and tried to create a database remotely using Safari Javascript Console,
bottom line I found that I was not able to create web database using iPhone Simulator,
looks like you need to deploy your app onto your device to make use of it.
I might be wrong, but that was what I found.

Unable to debug javascript in VS2010 with SP1

I am using Asp.Net MVC project and using jQuery to code JavaScript. Problem is I am not able to debug JavaScript. I searched for this issue and found a few threads. Basically this one:
Visual Studio 2010 script debugger doesn't work for me
And
The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application
None of these are currently working for me. I tried to launch my application in Chrome and IE9 but my breakpoint just doesn't get hit.
Can you tell me what is the issue?
Use IE9 with the F12 developer tools, FF5/FireBug and Chrome. They all have good javaScript debuggers. It's a good idea to use all of them.

Debug JavaScript in Visual Studio 2010?

Currently I am debugging my JavaScript using Firebug for Firefox. Is there anyway to debug javascript in Visual Studio 2010? The JavaScript isn't part of any Visual Studio project, it's just a .js file that will be linked to a static HTML page (it's to debug school assignments).
I did try searching and the results weren't any more recent than around a year ago. I'm hoping something has changed or there is a better workflow than notepad++ for HTML/JavaScript and Firebug for debugging.
Use the JavaScript debugger keyword in IE.
function onClickRow(detailUrl) {
debugger;
}
When run your page in IE, a debug window will pop up, then select Visual Studio 11.
To use debug in Internet Explorer, you need perform these steps:
enable script debugging in IE (go to Internet options->advanced->browsing and uncheck 'Disable script debugging')
select view->external script debugger->break on next statement
When next javascript statement will be reached, IE will show standard windows debugger selection dialog, when you can select instance of visual studio.
Update:
With visual studio you can attach to browser process(e.g. iexplore.exe) and then debug
This question gets a lot of views so for the sake of completeness I just wanted to mention that I've been using Chrome Developer Tools for a while now. It's been working great for me and is what I recommend now when people ask me this same question.
Yes, but only in IE. Basically just create a web-page project and hit run. It'll launch IE in debugger mode.
disable option from Internet Options like here : http://www.mayanksrivastava.com/2010/02/debugging-java-script-in-visual-studio.html
If you installed VS 2012 and then uninstalled it, you may need to Re-Install Visual Studio 2010.
Error you may get when trying to debug JavaScript:
---------------------------
Microsoft Visual Studio
---------------------------
Unable to attach to the crashing process. The correct version of pdm.dll is not registered. Repair your Visual Studio 2010 installation, or run 'regsvr32.exe "%CommonProgramFiles%\Microsoft Shared\VS7Debug\pdm.dll"'.
---------------------------
OK
---------------------------
If you want to try giving it a shot in IE, I posted about using the js debugger here:
jQuery/Ajax content not appearing/loading in Explorer

Categories