I have a phonegap application that is throwing a javascript error. I have had the HTML page open in a browser on the desktop and it works fine there without any error. When I load it in the android emulator the window.onerror event is getting fired, but I can't see any useful information in the error object to see where it's coming from. I have this to try to get more out of the error object:
window.onerror = function(e){
for(var i in e){
console.log("window.onerror ::" + i + ' = ' + e[i]);
}
};
But I don't even see a 'message' property. Here's the output:
window.onerror ::undefined
window.onerror ::eventPhase = 3
window.onerror ::currentTarget = [object DOMWindow]
window.onerror ::cancelable = false
window.onerror ::target = [object HTMLScriptElement]
window.onerror ::bubbles = true
window.onerror ::type = error
window.onerror ::cancelBubble = false
window.onerror ::clipboardData = undefined
window.onerror ::srcElement = [object HTMLScriptElement]
window.onerror ::defaultPrevented = false
window.onerror ::timeStamp = 1330975112077
window.onerror ::returnValue = true
window.onerror ::stopPropagation = function stopPropagation() { [native code] }
window.onerror ::preventDefault = function preventDefault() { [native code] }
window.onerror ::initEvent = function initEvent() { [native code] }
window.onerror ::stopImmediatePropagation = function stopImmediatePropagation() { [native code] }
window.onerror ::CAPTURING_PHASE = 1
window.onerror ::AT_TARGET = 2
window.onerror ::BUBBLING_PHASE = 3
window.onerror ::MOUSEDOWN = 1
window.onerror ::MOUSEUP = 2
window.onerror ::MOUSEOVER = 4
window.onerror ::MOUSEOUT = 8
window.onerror ::MOUSEMOVE = 16
window.onerror ::MOUSEDRAG = 32
window.onerror ::CLICK = 64
window.onerror ::DBLCLICK = 128
window.onerror ::KEYDOWN = 256
window.onerror ::KEYUP = 512
window.onerror ::KEYPRESS = 1024
window.onerror ::DRAGDROP = 2048
window.onerror ::FOCUS = 4096
window.onerror ::BLUR = 8192
window.onerror ::SELECT = 16384
window.onerror ::CHANGE = 32768
What else can I do to find the problem?
Now you can install Chrome for android and remote debug/analyze your application in the same way you would do with regular chrome:
http://code.google.com/chrome/mobile/docs/debugging.html
To install Chrome in the emulator:
it may take a while to install. Then follow the instructions to remote debug your web application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With