Hi Javi,
Yes I think you found the problem! The way cordova.js an other plugin JavaScript files are handled is a bit special. Let me explain.
When you build a Cordova app and load the HTML from a local file everything is fine, since cordova.js and associated files are bundled with the app on the local file system. But when you load an external HTML file into the app from a server, that file cannot access local files. There is no build-in way to access the locally stored cordova.js files because of security risks.
Below are some options for working around this problem.
1. The first option is a trick that Evothings Client uses. In native code on iOS and Android, there are "hooks" that check for cordova.js and plugin files, and when detected loads them from the local file system. So thsi is one option to use from your Cordova app. The native source code is found here:
https://github.com/evothings/evothings- ... fig/native2. The second option, which could be easier to implement, is to serve the cordova.js files from the server, same server that serves the HTML/JS files for the application. Now the problem with this is that the cordova.js files are different depending on the platform. There is one set of files for iOS and one set of files for Android. This means that you need to handle this somehow. Below are some alternatives.
2.1 The first alternative is to maintain separate file trees on the server, one for iOS and one for Android, and point to the relevant one from your Cordova build for each platform (the build app for Android would point to one location, the one for iOS to another location).
2.2 The second alternative is to detect the platform dynamically in the HTML/JS code and conditionally load the cordova.js files for the current platform. You can use document.write() to insert the right script tag for cordova.js (people will complain about using document.write but I don't care). See this code for some hints regarding this approach (I see now this code could be improved, but still it could work as an example, just do the script tag generation instead of the meta tag):
https://github.com/evothings/evothings- ... yper-os.jshttps://github.com/evothings/evothings- ... iewport.js2.3 The third alternative is to detect the platform in the server code, and serve the correct cordova.js files. This method is used by Evothings Workbench when you are using your own Cordova application with the Workbench. The code is here, look in function serveCordovaFile:
https://github.com/divineprog/HyperRelo ... -server.jsIt might be possible to adopt this alternative for your PHP application, but I suspect it could be tricky.
I think I would have chosen solution 2.2 since this allows serving the cordova.js and related files as standard static files.
Do you think any of this could help in your case?
Best regards, Mikael