Should I report this Cordova bug to github?

  • Hi, I can’t get Cordova wrappers/builds to work correctly out of the box (only building for iPhone at the moment), but I have a workaround which DOES allow it to work, and it involves adding code to the index.html file in my dist build folder.

    Here is the code I need to add to index.html every time so that plugins will work:

    <script type=text/javascript src=cordova.js>
    <script type=text/javascript>
    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {

    without this, my projects will build, but they won’t use any cordova plugins (like statusbar). Or is there some other trick to getting plugins working in cordova that I am missing? If so, I am all ears.

  • Admin

    Quasar takes of Cordova integration automatically. It adds that script tag and waits for deviceready event to be triggered (through Quasar.start(...)). You don’t need to manually add this.

    Check the default template.

  • Believe me, it will not run properly unless I take this extra step. If I leave it out, and let it build (rather, let quasar build, because it is a result of that process I need to modify) run its course, and then build with what it is using by default, I will not have access to cordova plugin functionality. This results in things like the toolbar crashing into the status bar (which is fixed by a normally working cordova statusbar plugin). So I just added my code to the default index.html file in src, and it works the same way as if I add it after the build, but you seem to indicate this should not be necessary. I have tried a bunch of ways without and it refuses to run properly in cordova builds for ios without it.

  • This post is deleted!

  • @rstoenescu I would like to revisit and fix this problem. I just re-setup Cordova (quasar wrap cordova) and the problem is the same. it builds fine and plugins work on Android, but on iOS it is necessary to include the Cordova script by hand in the index.html file or plugins will not work. Can you point me to where in the code it is building the iOS part? I notice a few differences between the android and iOS folders in platforms in Cordova tree…for example, the iOS folder contains a www folder at the top level whereas the android folder does not. I am happy to chase down any avenues because I think this is an important bug to fix, but I could use a little guidance. Do you want me to report this bug in Github?

  • Some more info: I have also tried removing and re-adding iOS platform, and upgrading iOS platform to 4.5.1 - still have the same problem. Is this a Cordova bug or a Quasar bug? I am not sure…

  • and more: I have verified that the index.html and three js files (app, manifest and vendor) are identical between their iOS and Android generated versions (in /platforms/ios/www and /platforms/android/assets/www respectively). Also the other files present in each folder seem to match. So at some point when the bundle gets loaded onto my iPhone or simulator, plugins will not work without force including it in the index.html file…

  • Does really NO ONE ELSE have this problem?!! Is no one building for ios?

  • Hi, I’m no cordova expert, just a long time non-web programmer, but often situations like you describe are related to timing, and although I know you are an accomplished programmer, I’ll write extra to be more helpful to others.

    If you have time to play with a new blank template, out of the box functionality and the dumbest possible plugin like vibration alone, or whatever, and it doesn’t work, you could post it and rstoenescu might be able to quickly track down why. Also consider it might work for android and then not ios. Of course, as you know, if the simple version does function without your workaround, you then get to try adding each additional plugin back until you find the conflict. 🎰

  • I FINALLY know why this is happening! I am using the ionic supplied plugin cordova-plugin-ionic-webview, because it provides a MUCH faster web view (WKWebview) than the built in one (the quite old UIWebView). But when using this, it does not by default include the reference to cordova.js like the built in one. So while it itself is a plugin and loads, it apparently prevents other plugins from loading. So now I just need to figure out how to get it to automatically include the reference so I don’t have to keep including it by hand.

Log in to reply