Windows Phone + Cordova Quick Tip

Windows Phone + Cordova Quick Tip

When javascript doesn’t seem to be working, I usually hack in a quick error handler.
If you add this somewhere at the top of your html page, you should see any errors that occur listed in Visual Studio’s output window.

window.onerror = function(errMsg,fileName,ln) {
    window.external.Notify("Error : " + errMsg +
            ", In file : " + fileName +
            ", at line number:" + ln);
  1. ajs

    If you’re sending text to the Visual Studio output window, you can format the text so that you can open the source file just by double-clicking the line in the output window. Needs to look like this:
    filename(linenumber): message

  2. Jesse

    I’ll have to look into that ajs, thanks.

    No Twitter Messages