Question

I have recently upgraded to Cordova 3.5 and noticed that on most app start ups (iOS & Android) I would get a xxx is undefined where xxx = any of the plugin variables. i.e. device, confirm, etc.

Was it helpful?

Solution

After days of digging I found that the problem lies with the BASE tag I was using in my index.html document. I use this tag to identify my domain so I can use relative paths in my scripts. If you do not do this then relative paths will be derived locally from the app. You do not need the BASE tag if all of your paths have your domain in them.

Apparently the BASE tag now causes the app to not be able to find the plugin javascript source that is local. I tried placing the BASE tag elsewhere in the document and it did resolve it for iOS but not for Android.

This also causes problems with apps that are paused. You may get your app to start fine but once it restarts, your BASE element is already defined and all further looks for the plugin javascript will be derived from that BASE.

SOLUTION - I rewrote my application to remove the BASE element.

Sharing with others so they do not bang their head against the wall for days like I did. Cheers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top